tomhoad Posted February 26, 2009 Share Posted February 26, 2009 Simple question... I've fiddled around with some of the for, do while etc. statements and cant find the one that does what i need it to do. if ($i = 0){ $output .= '<a target="_new" href="'.$rss->items[$i]['link'].'">'.$rss->items[$i]['title'].'</a><br>'; $output .= $rss->items[$i]['description'].'<br><br>'; } echo $output; for ($i = 1; $i < sizeof($rss->items); $i++){ $output .= '<a target="_new" href="'.$rss->items[$i]['link'].'">'.$rss->items[$i]['title'].'</a><br>'; } echo $output; Basically I want to display the full article if it's the first one, and just a list of article titles for the others. I don't think the above code makes logical sense anyway, but I can't seem to figure out what I need Any help app. thanks Link to comment https://forums.phpfreaks.com/topic/147005-making-the-first-article-appear-differently-to-the-rest/ Share on other sites More sharing options...
rhodesa Posted February 26, 2009 Share Posted February 26, 2009 the code wasn't working cus your if didn't have a double equal sign. i also rearranged the code a little: for ($i = 0; $i < count($rss->items); $i++){ $output .= '<a target="_new" href="'.$rss->items[$i]['link'].'">'.$rss->items[$i]['title'].'</a><br>'; if ($i == 0){ $output .= $rss->items[$i]['description'].'<br><br>'; } } echo $output; Link to comment https://forums.phpfreaks.com/topic/147005-making-the-first-article-appear-differently-to-the-rest/#findComment-771796 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.