Welcome Guest, Not a member yet? Register   Sign In
newbie need ur help!!
#2

[eluser]iConTM[/eluser]
A quick solution could be this:

Code:
$menu = array(
array(
  'name' => 'home',
  'url' => base_url() . 'home', // reference to the controller
  'children'
    => array(
     array( 'name' => 'sub menu1', 'url' => base_url() . 'home/smenu1' ), // where smenu1 is the function within the home controller
     array( 'name' => 'sub menu2', 'url' => base_url() . 'home/smenu2' )
    )
),
array( 'name' => 'products ', 'url'=> '', 'children' => array() ),
array( 'name' => 'contact ', 'url' => '', 'children' => array()),
array( 'name' => 'login', 'url' => '', 'children' => array())
);

for the HTML:

Code:
<ul class='menu'>

&lt;?php foreach ($menu as $item) : ?&gt;
<li><a href="&lt;?php echo $item['url'] ?&gt;">&lt;?php echo $item['name'] ?&gt;</a></li>

&lt;?php if ( is_array($item['children']) && count($item['children']) > 0 ) : ?&gt;
<ul>

&lt;?php foreach ($item['children'] as $subitem) : ?&gt;
<li><a href="&lt;?php echo $subitem['url'] ?&gt;">&lt;?php echo $subitem['name'] ?&gt;</a></li>
&lt;?php endforeach; ?&gt;

</ul>
&lt;?php endif; ?&gt;

&lt;?php endforeach; ?&gt;
</ul>


Messages In This Thread
newbie need ur help!! - by El Forum - 06-20-2010, 04:47 AM
newbie need ur help!! - by El Forum - 06-20-2010, 05:23 AM
newbie need ur help!! - by El Forum - 06-20-2010, 05:35 AM
newbie need ur help!! - by El Forum - 06-20-2010, 06:09 AM
newbie need ur help!! - by El Forum - 06-20-2010, 08:31 AM
newbie need ur help!! - by El Forum - 06-20-2010, 03:50 PM
newbie need ur help!! - by El Forum - 06-20-2010, 04:18 PM
newbie need ur help!! - by El Forum - 06-20-2010, 07:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB