Jump to content

what is wrong wthi this code?


ercio

Recommended Posts

I got this error Warning: Invalid argument supplied for foreach() in /home/ercio/public_html/lib/skins/lance/frontpage_recentpilots.tpl on line 3

<ul style="margin-top:10px; margin-left:3px;width:100%;" class="list-group">
<?php
foreach($allpilot_list as $allpilot) {
?>
 <li class="list-group-item"><img src="<?php echo Countries::getCountryImage($pilot->location);?>"
  alt="<?php echo Countries::getCountryName($pilot->location);?>" />  <a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><font color="#2f2f2f"><?php echo $pilot->firstname.' '.$pilot->lastname ?></font></a></li>
<?php
}
?>
</ul>

Link to comment
Share on other sites

  • Moderators

It seems that you are using a wrong variable on your foreach. Can you try using this instead?

<ul style="margin-top:10px; margin-left:3px;width:100%;" class="list-group">
<?php
foreach($pilots as $allpilot) {
?>
<li class="list-group-item"><img src="<?php echo Countries::getCountryImage($pilot->location);?>"
alt="<?php echo Countries::getCountryName($pilot->location);?>" />  <a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><font color="#2f2f2f"><?php echo $pilot->firstname.' '.$pilot->lastname ?></font></a></li>
<?php
}
?>
</ul>

Link to comment
Share on other sites

  • Moderators

This should work correctly:

<ul style="margin-top:10px; margin-left:3px;width:100%;" class="list-group">
<?php
foreach($pilots as $pilot) {
?>
<li class="list-group-item"><img src="<?php echo Countries::getCountryImage($pilot->location);?>"
alt="<?php echo Countries::getCountryName($pilot->location);?>" />  <a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><font color="#2f2f2f"><?php echo $pilot->firstname.' '.$pilot->lastname ?></font></a></li>
<?php
}
?>
</ul>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...