Welcome Guest, Not a member yet? Register   Sign In
Beginner Qs: Nav structure and internationalization
#1

[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>
        &lt;?php foreach($links as $link=>$linkName){ ?&gt;
        <li class="&lt;?php echo $link ?&gt;&lt;?php if($sectionName == $link){ ?&gt; on&lt;? } ?&gt;"><a href="&lt;?php echo base_url() . $link ?&gt;/">&lt;?php echo $linkName ?&gt;</a></li>
        &lt;?php } ?&gt;
    </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.


Messages In This Thread
Beginner Qs: Nav structure and internationalization - by El Forum - 05-13-2011, 02:33 AM
Beginner Qs: Nav structure and internationalization - by El Forum - 05-13-2011, 09:34 AM
Beginner Qs: Nav structure and internationalization - by El Forum - 05-13-2011, 02:26 PM
Beginner Qs: Nav structure and internationalization - by El Forum - 05-15-2011, 03:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB