JREAM Posted November 13, 2008 Share Posted November 13, 2008 <?php $page = $this->find('/pages'); for ($x = 0; $x < $page; $x++){ // This doesnt seem to do anything $items = '<ul class="sidemenu">'; $items .= '<li>'.$page->link($page->title, (in_array($page->slug, explode('/', $this->url)) ? ' class="current"': null)).'</li>'; displayChildren($page, $this, false, array('articles' => '3', 'a-sub-page' => '1')); $items .= '</ul>'; echo $x; // This just stays at 0 } ?> Im just trying to make a loop, so that when all the items get listed, it splits them into two columns. So if there are 11 pages in the directory, it will split it into a row of 6, then a row of 5. Does anyone have liberty to help me please Link to comment https://forums.phpfreaks.com/topic/132618-for-loop/ Share on other sites More sharing options...
bobbinsbro Posted November 13, 2008 Share Posted November 13, 2008 err... are you sure $this->find() returns a number != 0 into $page? Link to comment https://forums.phpfreaks.com/topic/132618-for-loop/#findComment-689613 Share on other sites More sharing options...
trq Posted November 13, 2008 Share Posted November 13, 2008 I take it $page is an array? for ($x = 0; $x < count($page); $x++) { Link to comment https://forums.phpfreaks.com/topic/132618-for-loop/#findComment-689616 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.