Welcome Guest, Not a member yet? Register   Sign In
Working with multi-diminsional array
#1

[eluser]xtremer360[/eluser]
I'm wanting my end result to turn out something like this:
Code:
<ul id="nav_main">
    <li class="current">
        <a href="#">
            <img src="img/icons/25x25/dark/computer-imac.png" alt="">
             Dashboard
        </a>
        <ul>
            <li class="current">
                <a href="dashboard.html">Dashboard</a>
            </li>
            <li>
                <a href="404.html">404</a>
            </li>
            <li>
                <a href="login.html">Login</a>
           </li>
        </ul>
    </li>
</ul>

As of right now I have this:

Code:
$list = array(
    anchor('#', img())
);
$attributes = array(
    'class' => 'nav_main'
);
?&gt;
&lt;?php echo ul($list, $attributes); ?&gt;
#2

[eluser]CroNiX[/eluser]
You can't do all of that using that helper. It has no way to create classes/ids for the <li> elements.
#3

[eluser]xtremer360[/eluser]
What do you suggest I do?
#4

[eluser]CroNiX[/eluser]
Either make your own helper that will allow you to add attributes to the <li> elements or just code it in html, looping through your data to create the <li> and <a>/<img> elements.
#5

[eluser]xtremer360[/eluser]
I'm trying to look around for anyone who might have extended the html helper but not having any luck. Do you know of anyone who has.
#6

[eluser]CroNiX[/eluser]
Nope, and I'm not sure it would be best for what you are trying to do either. For instance, entering the class "current" when you are on a certain page. You'd have to create an array (or something) that told it some particular <li> gets that class. It would be a lot faster just to create the <li> elements in a loop.




Theme © iAndrew 2016 - Forum software by © MyBB