mikefrederick Posted March 5, 2008 Share Posted March 5, 2008 so i have the following class file. I have never dealt with classes before, how do I echo $events[0]["id"] on a separate page? include it and then what? <? class StaticEvents { function StaticEvents() { } function getEvents() { $events = array(); $events[0]["id"] = "1194660001"; $events[0]["name"] = "Men's Retreat 1"; $events[0]["version"] = "7d5e07"; $events[0]["season"] = "Fall"; $events[0]["category"] = "Adult"; $events[0]["date_lbound"] = "2007-11-9 7:00 PM"; $events[0]["date_ubound"] = "2007-11-11 11:00 AM"; $events[0]["display"] = "False"; $events[0]["register"] = "False"; $events[0]["audience"] = ""; $events[0]["intro"] = "njoy fall in the mountain"; $events[1]["id"] = "1195264801"; $events[1]["name"] = "Mens Retreat 2"; $events[1]["version"] = "7d5e07"; $events[1]["season"] = "Fall"; $events[1]["category"] = "Adult"; $events[1]["date_lbound"] = "2007-11-16 7:00 PM"; $events[1]["date_ubound"] = "2007-11-18 11:00 AM"; $events[1]["display"] = "False"; $events[1]["register"] = "False"; $events[1]["audience"] = ""; $events[1]["intro"] = "njoy fall in the mountain"; $events[2]["id"] = "1197079201"; $events[2]["name"] = "Youth Workers Retreat"; $events[2]["version"] = "7d5e07"; $events[2]["season"] = "Fall"; $events[2]["category"] = "Adult"; $events[2]["date_lbound"] = "2007-12-7 7:00 PM"; $events[2]["date_ubound"] = "2007-12-9 11:00 AM"; $events[2]["display"] = "False"; $events[2]["register"] = "Disabled"; $events[2]["audience"] = "Youth Workers"; $events[2]["intro"] = "ome for a weekend with so"; $events[3]["id"] = "1199498401"; $events[3]["name"] = "Deep Freeze Jr. & Sr. (Jan 4-6) CALL OFFICE"; $events[3]["version"] = "7d5e01"; $events[3]["season"] = "Winter"; $events[3]["category"] = "Youth"; $events[3]["date_lbound"] = "2008-1-4 7:00 PM"; $events[3]["date_ubound"] = "2008-1-6 1:00 PM"; $events[3]["display"] = "True"; $events[3]["register"] = "Phone Only"; $events[3]["audience"] = "Jr. & Sr. High Youth Groups"; $events[3]["intro"] = "he world has a lot to say"; $events[4]["id"] = "1168567202"; $events[4]["name"] = "Deep Freeze Jr. & Sr. (Jan 11-13) CALL OFFICE"; $events[4]["version"] = "7d5e01"; $events[4]["season"] = "Winter"; $events[4]["category"] = "Youth"; $events[4]["date_lbound"] = "2008-1-11 7:00 PM"; $events[4]["date_ubound"] = "2008-1-13 1:00 PM"; $events[4]["display"] = "True"; $events[4]["register"] = "Phone Only"; $events[4]["audience"] = "Jr. & Sr. High Youth Groups"; $events[4]["intro"] = "he world has a lot to say"; $events[5]["id"] = "1169172001"; $events[5]["name"] = "Deep Freeze Jr. & Sr. (Jan 18-20)"; $events[5]["version"] = "7d5e01"; $events[5]["season"] = "Winter"; $events[5]["category"] = "Youth"; $events[5]["date_lbound"] = "2008-1-18 7:00 PM"; $events[5]["date_ubound"] = "2008-1-20 1:00 PM"; $events[5]["display"] = "True"; $events[5]["register"] = "Open"; $events[5]["audience"] = "Jr. & Sr. High Youth Groups"; $events[5]["intro"] = "he world has a lot to say"; $events[6]["id"] = "1169776801"; $events[6]["name"] = "Deep Freeze Jr. & Sr. (Jan 25-27) "; $events[6]["version"] = "7d5e01"; $events[6]["season"] = "Winter"; $events[6]["category"] = "Youth"; $events[6]["date_lbound"] = "2008-1-25 7:00 PM"; $events[6]["date_ubound"] = "2008-1-27 1:00 PM"; $events[6]["display"] = "True"; $events[6]["register"] = "Open"; $events[6]["audience"] = "Youth Groups"; $events[6]["intro"] = "he world has a lot to say"; $events[7]["id"] = "1201917601"; $events[7]["name"] = "Deep Freeze Jr. High (Feb 1-3) "; $events[7]["version"] = "7d5e01"; $events[7]["season"] = "Winter"; $events[7]["category"] = "Youth"; $events[7]["date_lbound"] = "2008-2-1 7:00 PM"; $events[7]["date_ubound"] = "2008-2-3 1:00 PM"; $events[7]["display"] = "True"; $events[7]["register"] = "Open"; $events[7]["audience"] = "Youth Groups"; $events[7]["intro"] = "he world has a lot to say"; $events[8]["id"] = "1202522401"; $events[8]["name"] = "Deep Freeze Jr. & Sr. (Feb 8-10) CALL OFFICE"; $events[8]["version"] = "7d5e01"; $events[8]["season"] = "Winter"; $events[8]["category"] = "Youth"; $events[8]["date_lbound"] = "2008-2-8 7:00 PM"; $events[8]["date_ubound"] = "2008-2-10 1:00 PM"; $events[8]["display"] = "True"; $events[8]["register"] = "Phone Only"; $events[8]["audience"] = "Youth Groups"; $events[8]["intro"] = "he world has a lot to say"; $events[9]["id"] = "1203127201"; $events[9]["name"] = "Deep Freeze Jr. & Sr. (Feb 15-17) CALL OFFICE"; $events[9]["version"] = "7d5e01"; $events[9]["season"] = "Winter"; $events[9]["category"] = "Youth"; $events[9]["date_lbound"] = "2008-2-15 7:00 PM"; $events[9]["date_ubound"] = "2008-2-17 1:00 PM"; $events[9]["display"] = "True"; $events[9]["register"] = "Phone Only"; $events[9]["audience"] = "Youth Groups"; $events[9]["intro"] = "he world has a lot to say"; $events[10]["id"] = "1203732001"; $events[10]["name"] = "Deep Freeze Sr. High and Jr. High! (Feb 22-24)"; $events[10]["version"] = "7d5e01"; $events[10]["season"] = "Winter"; $events[10]["category"] = "Youth"; $events[10]["date_lbound"] = "2008-2-22 7:00 PM"; $events[10]["date_ubound"] = "2008-2-24 1:00 PM"; $events[10]["display"] = "True"; $events[10]["register"] = "Open"; $events[10]["audience"] = "Youth Groups"; $events[10]["intro"] = "he world has a lot to say"; $events[11]["id"] = "1204336801"; $events[11]["name"] = "Deep Freeze Jr. & Sr. (Feb 29-Mar 2) CALL OFFICE"; $events[11]["version"] = "7d5e01"; $events[11]["season"] = "Winter"; $events[11]["category"] = "Youth"; $events[11]["date_lbound"] = "2008-2-29 7:00 PM"; $events[11]["date_ubound"] = "2008-3-2 1:00 PM"; $events[11]["display"] = "True"; $events[11]["register"] = "Phone Only"; $events[11]["audience"] = "Youth Groups"; $events[11]["intro"] = "he world has a lot to say"; $events[12]["id"] = "1204941601"; $events[12]["name"] = "Deep Freeze Jr. & Sr. (Mar 7-9) CALL OFFICE"; $events[12]["version"] = "7d5e01"; $events[12]["season"] = "Winter"; $events[12]["category"] = "Youth"; $events[12]["date_lbound"] = "2008-3-7 7:00 PM"; $events[12]["date_ubound"] = "2008-3-9 1:00 PM"; $events[12]["display"] = "True"; $events[12]["register"] = "Phone Only"; $events[12]["audience"] = "Youth Groups"; $events[12]["intro"] = "he world has a lot to say"; $events[13]["id"] = "1205546401"; $events[13]["name"] = "Deep Freeze Jr. & Sr. (Mar 14-16)"; $events[13]["version"] = "7d5e01"; $events[13]["season"] = "Winter"; $events[13]["category"] = "Youth"; $events[13]["date_lbound"] = "2008-3-14 7:00 PM"; $events[13]["date_ubound"] = "2008-3-16 1:00 PM"; $events[13]["display"] = "True"; $events[13]["register"] = "Open"; $events[13]["audience"] = "Youth Groups"; $events[13]["intro"] = "he world has a lot to say"; $events[14]["id"] = "1210384801"; $events[14]["name"] = "Mother/Daughter Retreat"; $events[14]["version"] = "7d5e03"; $events[14]["season"] = "Spring"; $events[14]["category"] = "Family"; $events[14]["date_lbound"] = "2008-5-9 7:00 PM"; $events[14]["date_ubound"] = "2008-5-11 11:00 AM"; $events[14]["display"] = "True"; $events[14]["register"] = "True"; $events[14]["audience"] = "Mothers and daughters, ages 5 & up."; $events[14]["intro"] = "et away and devote an ent"; $events[15]["id"] = "1212804001"; $events[15]["name"] = "Father/Son Retreat"; $events[15]["version"] = "7d5e03"; $events[15]["season"] = "Spring"; $events[15]["category"] = "Family"; $events[15]["date_lbound"] = "2008-6-6 7:00 PM"; $events[15]["date_ubound"] = "2008-6-8 11:00 AM"; $events[15]["display"] = "True"; $events[15]["register"] = "True"; $events[15]["audience"] = "Fathers and Sons ages 5 & up"; $events[15]["intro"] = "evote some quality time c"; $events[16]["id"] = "1214168401"; $events[16]["name"] = "Primary/Junior Camp"; $events[16]["version"] = "7d5e05"; $events[16]["season"] = "Summer"; $events[16]["category"] = "Youth"; $events[16]["date_lbound"] = "2008-6-22 2:00 PM"; $events[16]["date_ubound"] = "2008-6-28 11:00 AM"; $events[16]["display"] = "True"; $events[16]["register"] = "Open"; $events[16]["audience"] = "Co-ed (completed 2nd thru 5th)"; $events[16]["intro"] = "our young camper will jum"; $events[17]["id"] = "1214773201"; $events[17]["name"] = "Jr./Sr. High Camp"; $events[17]["version"] = "7d5e05"; $events[17]["season"] = "Summer"; $events[17]["category"] = "Youth"; $events[17]["date_lbound"] = "2008-6-29 2:00 PM"; $events[17]["date_ubound"] = "2008-7-5 11:00 AM"; $events[17]["display"] = "True"; $events[17]["register"] = "Open"; $events[17]["audience"] = ""; $events[17]["intro"] = "ake the chance to build l"; $events[18]["id"] = "1215378001"; $events[18]["name"] = "Boys' Camp"; $events[18]["version"] = "7d5e05"; $events[18]["season"] = "Summer"; $events[18]["category"] = "Youth"; $events[18]["date_lbound"] = "2008-7-6 2:00 PM"; $events[18]["date_ubound"] = "2008-7-12 1:00 AM"; $events[18]["display"] = "True"; $events[18]["register"] = "True"; $events[18]["audience"] = "Boys (completed 4th thru 8th grade)"; $events[18]["intro"] = "oys, this is non-stop exc"; $events[19]["id"] = "1167703202"; $events[19]["name"] = "Jr. High #1 Camp"; $events[19]["version"] = "7d5e05"; $events[19]["season"] = "Summer"; $events[19]["category"] = "Youth"; $events[19]["date_lbound"] = "2008-7-13 2:00 PM"; $events[19]["date_ubound"] = "2008-7-19 1:00 AM"; $events[19]["display"] = "True"; $events[19]["register"] = "True"; $events[19]["audience"] = "Co-ed (completed 6th thru 8th grade)"; $events[19]["intro"] = "ickin'! This sweet week"; $events[20]["id"] = "1216587601"; $events[20]["name"] = "Girl's Camp"; $events[20]["version"] = "7d5e05"; $events[20]["season"] = "Summer"; $events[20]["category"] = "Youth"; $events[20]["date_lbound"] = "2008-7-20 2:00 PM"; $events[20]["date_ubound"] = "2008-7-26 1:00 AM"; $events[20]["display"] = "True"; $events[20]["register"] = "True"; $events[20]["audience"] = "Girls (completed 4th - 8th grade)"; $events[20]["intro"] = "ear not - no annoying boy"; $events[21]["id"] = "1167703203"; $events[21]["name"] = "Senior High Camp"; $events[21]["version"] = "7d5e05"; $events[21]["season"] = "Summer"; $events[21]["category"] = "Youth"; $events[21]["date_lbound"] = "2008-7-27 2:00 PM"; $events[21]["date_ubound"] = "2008-8-2 1:00 AM"; $events[21]["display"] = "True"; $events[21]["register"] = "Open"; $events[21]["audience"] = "Co-ed (completed 9th thru 12th grade)"; $events[21]["intro"] = "ake the chance to build l"; $events[22]["id"] = "1217797201"; $events[22]["name"] = "Jr. High #2 Camp"; $events[22]["version"] = "7d5e05"; $events[22]["season"] = "Summer"; $events[22]["category"] = "Youth"; $events[22]["date_lbound"] = "2008-8-3 2:00 PM"; $events[22]["date_ubound"] = "2008-8-9 1:00 AM"; $events[22]["display"] = "True"; $events[22]["register"] = "Open"; $events[22]["audience"] = "Co-ed (completed 6th thru 8th grade)"; $events[22]["intro"] = "ickin'! This sweet week"; $events[23]["id"] = "1218315601"; $events[23]["name"] = "Family Week #1"; $events[23]["version"] = "7d5e03"; $events[23]["season"] = "Late Summer"; $events[23]["category"] = "Family"; $events[23]["date_lbound"] = "2008-8-9 2:00 PM"; $events[23]["date_ubound"] = "2008-8-15 1:00 AM"; $events[23]["display"] = "True"; $events[23]["register"] = "Phone Only"; $events[23]["audience"] = "Couples and Familes"; $events[23]["intro"] = "amily Camp carries on the"; $events[24]["id"] = "1167703204"; $events[24]["name"] = "Family Week #2"; $events[24]["version"] = "7d5e03"; $events[24]["season"] = "Late Summer"; $events[24]["category"] = "Family"; $events[24]["date_lbound"] = "2008-8-16 2:00 PM"; $events[24]["date_ubound"] = "2008-8-22 1:00 AM"; $events[24]["display"] = "True"; $events[24]["register"] = "Phone Only"; $events[24]["audience"] = "Couples and Familes"; $events[24]["intro"] = "amily Camp carries on the"; $events[25]["id"] = "1219456801"; $events[25]["name"] = "Ignite #1"; $events[25]["version"] = "7d5e01"; $events[25]["season"] = "Late Summer"; $events[25]["category"] = "Youth"; $events[25]["date_lbound"] = "2008-8-22 7:00 PM"; $events[25]["date_ubound"] = "2008-8-24 1:00 PM"; $events[25]["display"] = "True"; $events[25]["register"] = "Open"; $events[25]["audience"] = "Jr. & Sr. High Youth Groups"; $events[25]["intro"] = "magine this...a whole wee"; $events[26]["id"] = "1220666401"; $events[26]["name"] = "Ignite #2"; $events[26]["version"] = "7d5e01"; $events[26]["season"] = "Late Summer"; $events[26]["category"] = "Youth"; $events[26]["date_lbound"] = "2008-9-5 7:00 PM"; $events[26]["date_ubound"] = "2008-9-7 1:00 PM"; $events[26]["display"] = "True"; $events[26]["register"] = "True"; $events[26]["audience"] = "Jr. & Sr. High Youth Groups"; $events[26]["intro"] = "magine this...a whole wee"; $events[27]["id"] = "1167703205"; $events[27]["name"] = "Women's Retreat #1"; $events[27]["version"] = "7d5e07"; $events[27]["season"] = "Fall"; $events[27]["category"] = "Adult"; $events[27]["date_lbound"] = "2008-9-19 7:00 PM"; $events[27]["date_ubound"] = "2008-9-21 1:00 PM"; $events[27]["display"] = "True"; $events[27]["register"] = "True"; $events[27]["audience"] = ""; $events[27]["intro"] = ""; $events[28]["id"] = "1222480801"; $events[28]["name"] = "Women's Retreat #2"; $events[28]["version"] = "7d5e07"; $events[28]["season"] = "Fall"; $events[28]["category"] = "Adult"; $events[28]["date_lbound"] = "2008-9-26 7:00 PM"; $events[28]["date_ubound"] = "2008-9-28 1:00 PM"; $events[28]["display"] = "True"; $events[28]["register"] = "True"; $events[28]["audience"] = ""; $events[28]["intro"] = ""; $events[29]["id"] = "1226714401"; $events[29]["name"] = "Men's Retreat 1"; $events[29]["version"] = "7d5e07"; $events[29]["season"] = "Fall"; $events[29]["category"] = "Adult"; $events[29]["date_lbound"] = "2008-11-14 7:00 PM"; $events[29]["date_ubound"] = "2008-11-16 11:00 AM"; $events[29]["display"] = "True"; $events[29]["register"] = "True"; $events[29]["audience"] = ""; $events[29]["intro"] = ""; $events[30]["id"] = "1227319201"; $events[30]["name"] = "Men's Retreat 2"; $events[30]["version"] = "7d5e07"; $events[30]["season"] = "Fall"; $events[30]["category"] = "Adult"; $events[30]["date_lbound"] = "2008-11-21 7:00 PM"; $events[30]["date_ubound"] = "2008-11-23 11:00 AM"; $events[30]["display"] = "True"; $events[30]["register"] = "True"; $events[30]["audience"] = ""; $events[30]["intro"] = ""; return $events; } } ?> Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted March 5, 2008 Share Posted March 5, 2008 try <?php include('file.php'); // File where code above is located StaticEvents::getEvents(); ?> Quote Link to comment Share on other sites More sharing options...
mikefrederick Posted March 5, 2008 Author Share Posted March 5, 2008 says Array Quote Link to comment Share on other sites More sharing options...
vbnullchar Posted March 5, 2008 Share Posted March 5, 2008 <?php $se = new StaticEvents(); $events_r = $se->getEvents(); echo $events_r[0]['id']; // to print entire array for($i=0; $i<=11; $i+=) { foreach($events_r[$i] as $value) { echo $value."\n"; } } ?> ?> Quote Link to comment Share on other sites More sharing options...
trq Posted March 5, 2008 Share Posted March 5, 2008 <?php include 'statcievents.class.php'; $obj = new StaticEvents; $events = $obj->getEvents(); echo $events[0]["id"]; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.