[eluser]rufisgumbo[/eluser]
My website has 3 levels of hierarchy so at present I've created a view file for each level (nav, sub_nav...)
The view files then contain arrays of links like this:
nav_view.php
Code:
<?
$links = array(
'home' => 'Home',
'general' => 'General Information',
'about' => 'About Acme Co',
'contact' => 'Contact Us'
);
?>
<nav>
<ul>
<?php foreach($links as $link=>$linkName){ ?>
<li class="<?php echo $link ?><?php if($sectionName == $link){ ?> on<? } ?>"><a href="<?php echo base_url() . $link ?>/"><?php echo $linkName ?></a></li>
<?php } ?>
</ul>
</nav>
And I use the URI class to determine active links for highlighting.
1. Would I be better combining all of these arrays into one controller file or defining them in a config file?, keeping just the output loop in the view.
2. I want to add translations for the nav items, what would be the best way to do that? in terms of structuring it and where best to define.