Splitting a UL into three even lists

Posted by Andy on Stack Overflow See other posts from Stack Overflow or by Andy
Published on 2010-12-30T11:42:17Z Indexed on 2010/12/30 11:54 UTC
Read the original article Hit count: 133

Filed under:

I am printing a menu using UL, the trouble is the order that is generated by my script is ignored because im printing the LI one after the other and they're spanning three across.

So the order is 1 , 2 , 3 as opposed to

1 2 3

To counteract this i wanted to split my single UL into three that way the order would be maintained.

Here is my code currently which works perfectly to print a single UL.

//Category Drop Down Menu       
$this->CategoryDropDownMenu = '<ul id="subcatmenu">';
foreach($sitemap->CategoryMenu as $val)             
    $this->CategoryDropDownMenu .= '<li><a href="'.$val[host].$val[link].'"><span>'.htmlspecialchars($val[title]).'</span></a></li>';
$this->CategoryDropDownMenu .= '</ul>';

© Stack Overflow or respective owner

Related posts about php