Navigation with links from db. How?

#1
[eluser]halex[/eluser]
I want to make navigation with link from a table, say 'links'.
A bad solution:
Any controller:
Code:
...
$data['for_left_nav']=$this->Links_model->get_all();
$data['for_content']=...
$this->load->view('partials/header', $data);
$this->load->view('view');
$this->load->view('partials/footer');

In ...partial/header:
Code:
<div id="container">
<div id="left_nav">
  <ul>
  &lt;?=foreach($for_left_nav as $link: ?&gt;
  <li>&lt;?=anchor($link,...</li>
  </ul>
....
</div> //left_nav
<div id="content">

This way I make database access for each page which use left_nav, although changes in 'links' table seldom happens.
Another solution is to search in sources as wordpress or joomla, but... I'm lazy ;-)
Are anybody a better solution for that?
Thanks.
(As you can see, I'm not an English speaker/writer, sorry)


Messages In This Thread
Navigation with links from db. How? - by El Forum - 04-15-2008, 05:06 AM
Navigation with links from db. How? - by El Forum - 04-17-2008, 01:11 AM
Navigation with links from db. How? - by El Forum - 04-17-2008, 01:23 AM
Navigation with links from db. How? - by El Forum - 04-17-2008, 02:23 AM
Navigation with links from db. How? - by El Forum - 04-17-2008, 01:56 PM
Navigation with links from db. How? - by El Forum - 04-21-2008, 08:53 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.