flyalaska Posted February 27, 2013 Report Share Posted February 27, 2013 I got the PIREPS tp post to Twitter, can not get the recent activity to post on my page, I get an error. Warning: Invalid argument supplied for foreach() in /home/flyakaco/public_html/lib/skins/flyalaska_1.0/activity_list.tpl on line 3 Line 3 is foreach($allactivities as $activity) { Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted March 1, 2013 Moderators Report Share Posted March 1, 2013 $allactivities should read the data from a class file. Something like : $allactivities = ActivityData::getActivity(); Quote Link to comment Share on other sites More sharing options...
flyalaska Posted March 1, 2013 Author Report Share Posted March 1, 2013 I tried that, it screws up my site. How do I exactly replace the code on line 3? foreach($allactivities as $activity) { Quote Link to comment Share on other sites More sharing options...
freshJet Posted March 1, 2013 Report Share Posted March 1, 2013 What is $allactivities ? Quote Link to comment Share on other sites More sharing options...
flyalaska Posted March 1, 2013 Author Report Share Posted March 1, 2013 from activity_list.tpl Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted March 2, 2013 Moderators Report Share Posted March 2, 2013 Try this: $count = 10; $allactivities = ActivityData::getActivity(array(), $count); Quote Link to comment Share on other sites More sharing options...
flyalaska Posted March 3, 2013 Author Report Share Posted March 3, 2013 same thing Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted March 4, 2013 Moderators Report Share Posted March 4, 2013 It works. Code: <h3>Activities</h3> <hr> <table> <?php $count = 10; $allactivities = ActivityData::getActivity(array(), $count); foreach($allactivities as $activity) { ?> <tr><td><?php echo $activity->message ;?></td></tr> <?php } ?> </table> Screenshot: Quote Link to comment Share on other sites More sharing options...
flyalaska Posted March 4, 2013 Author Report Share Posted March 4, 2013 I have progress. I have no errors now. http://www.flyaka.com/index.php/ Look on the bottom Not displaying the Name or pilot ID, neither is yours. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted March 4, 2013 Moderators Report Share Posted March 4, 2013 That's correct. Because I intended to show only the message. If you need to specify the pilot name along with the pilot ID then you'll need to get the pilot id and use it in another function to pull information for that pilot id, so: The code: <h3>Activities</h3> <hr> <table> <?php $count = 10; $allactivities = ActivityData::getActivity(array(), $count); foreach($allactivities as $activity) { $pilot = PilotData::getPilotData($activity->pilotid); ?> <tr><td><?php echo $pilot->code.$pilot->pilotid ;?> - <?php echo $pilot->firstname.' '.$pilot->lastname ;?> - <?php echo $activity->message ;?></td></tr> <?php } ?> </table> Screenshot: Quote Link to comment Share on other sites More sharing options...
flyalaska Posted March 4, 2013 Author Report Share Posted March 4, 2013 Thank you! That worked. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted March 5, 2013 Moderators Report Share Posted March 5, 2013 You're welcome. Do you want to add their country flag right next to their names? Quote Link to comment Share on other sites More sharing options...
flyalaska Posted March 5, 2013 Author Report Share Posted March 5, 2013 It's perfect the way it is. Thank for all your help. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted March 5, 2013 Moderators Report Share Posted March 5, 2013 rgr, yw Quote Link to comment Share on other sites More sharing options...
sherming Posted March 5, 2013 Report Share Posted March 5, 2013 Hi parkho, I would like to have the code with the country flag next to their names please Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted March 5, 2013 Moderators Report Share Posted March 5, 2013 lol! Of course you do. Let me come up with the code and let you know. Quote Link to comment Share on other sites More sharing options...
sherming Posted March 5, 2013 Report Share Posted March 5, 2013 Yeap haha, thanks Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted March 5, 2013 Moderators Report Share Posted March 5, 2013 The code: <h3>Activities</h3> <hr> <table> <?php $count = 10; $allactivities = ActivityData::getActivity(array(), $count); foreach($allactivities as $activity) { $pilot = PilotData::getPilotData($activity->pilotid); ?> <tr><td><?php echo $pilot->code.$pilot->pilotid ;?> - <?php echo $pilot->firstname.' '.$pilot->lastname ;?> ( <img src="<?php echo Countries::getCountryImage($pilot->location);?>"> ) - <?php echo $activity->message ;?> </td></tr> <?php } ?> </table> Screenshot: Quote Link to comment Share on other sites More sharing options...
sherming Posted March 5, 2013 Report Share Posted March 5, 2013 Thanks Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted March 5, 2013 Moderators Report Share Posted March 5, 2013 yw Quote Link to comment Share on other sites More sharing options...
flyalaska Posted March 6, 2013 Author Report Share Posted March 6, 2013 I ran into another issue. When a new pilot is accepted or when a pilot receives an award. It displays as -- has been promoted..... Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted March 6, 2013 Moderators Report Share Posted March 6, 2013 I think you have empty pilotid column for those rows in activity table. Quote Link to comment Share on other sites More sharing options...
Gantcho Posted April 9, 2013 Report Share Posted April 9, 2013 The code: <h3>Activities</h3> <hr> <table> <?php $count = 10; $allactivities = ActivityData::getActivity(array(), $count); foreach($allactivities as $activity) { $pilot = PilotData::getPilotData($activity->pilotid); ?> <tr><td><?php echo $pilot->code.$pilot->pilotid ;?> - <?php echo $pilot->firstname.' '.$pilot->lastname ;?> ( <img src="<?php echo Countries::getCountryImage($pilot->location);?>"> ) - <?php echo $activity->message ;?> </td></tr> <?php } ?> </table> Screenshot: Where we have to put it ?? Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted April 13, 2013 Moderators Report Share Posted April 13, 2013 Where we have to put it ?? Where you want to use it. Normally people will add that to their website's front page. Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted September 9, 2014 Moderators Report Share Posted September 9, 2014 Twitter changed its access policy in June 2013 and now this push no longer works, has anyone looked at this since? 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.