Welcome Guest, Not a member yet? Register   Sign In
Have one view page for my application.
#4

[eluser]techguy101[/eluser]
Wow, they were speedy replies..thanks guys.

I'm after going with bobbob's solution..it works like a treat.

One more thing. I just put an array at the very beginning of header.php to store menu items. I then use a for each loop to print them out in the nav bar furhter down..it will make adding menu items easy but is it the right way to do things??

Example:

Code:
<?php
    $navBar = array(
                        array('Home','home'),
                        array('Transactions','/transaction'),
                        array('Customers','/customer')
                        );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;&lt;?php echo $title; ?&gt;&lt;/title&gt;
    &lt;meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /&gt;
    &lt;style media="all" type="text/css"&gt;@import "http://192.168.72.128/grain/css/all.css";&lt;/style&gt;
    [removed][removed]



&lt;/head&gt;
&lt;body&gt;
<div id="main">
    <div id="header">
        <a href="splash.php" class="logo"><img src="img/logo.gif" width="101" height="29" alt="" /></a>
        <ul id="top-navigation">
            &lt;?php    
                    // Print out top navigation bar and apply active state to currently open page link.
                    foreach($navBar as $link):
                        if(strnatcasecmp($this->uri->segment(2),$link[0]) == 0)
                        {
                            echo '<li class="active"'; ?&gt;><span><span>&lt;?php echo $link[0];
                        }
                        else
                        {
                            echo '<li><span><span>'.anchor($link[1],$link[0]). '</span></span></li>';
                        }
                    endforeach;
            ?&gt;
        </ul>
    </div>


What do you think of this code? How would you improve it?

Thanks guys..

P.S. I only have <5 hours experience with CI but I absolutely love it!!


Messages In This Thread
Have one view page for my application. - by El Forum - 08-30-2009, 09:53 AM
Have one view page for my application. - by El Forum - 08-30-2009, 10:39 AM
Have one view page for my application. - by El Forum - 08-30-2009, 10:40 AM
Have one view page for my application. - by El Forum - 08-30-2009, 11:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB