Welcome Guest, Not a member yet? Register   Sign In
Can someone please explain this to me
#1

[eluser]bosco500[/eluser]
Can someone please explain this code to me? I was browsing through the design on the freakauth_demo, trying to understand the design. This line of code is from menu.php (view)

Code:
<?php $ci_uri = trim($this->uri->uri_string(), '/'); $att = ' id="active"';?>
    <ul id="navlist">
        <li&lt;?= $ci_uri == ''? $att: ''?&gt;>&lt;?=anchor('', 'home')?&gt;</li>
        <li&lt;?= substr($ci_uri, 0, 7) == 'example'? $att: ''?&gt;>&lt;?=anchor('example', 'examples')?&gt;</li>
        <li&lt;?= $ci_uri == $this->config->item('FAL_login_uri')? $att: ''?&gt;>&lt;?=anchor($this->config->item('FAL_login_uri'), 'login')?&gt;</li>
        <li&lt;?= $ci_uri == $this->config->item('FAL_register_uri')? $att: ''?&gt;>&lt;?=anchor($this->config->item('FAL_register_uri'), 'register')?&gt;</li>
        <li&lt;?= $ci_uri == $this->config->item('FAL_forgottenPassword_uri')? $att: ''?&gt;>&lt;?=anchor($this->config->item('FAL_forgottenPassword_uri'), 'forgotten password')?&gt;</li>
        <li&lt;?= $ci_uri == $this->config->item('FAL_changePassword_uri')? $att: ''?&gt;>&lt;?=anchor($this->config->item('FAL_changePassword_uri'), 'change password')?&gt;</li>
        <li&lt;?= substr($ci_uri, 0, 5) == 'admin'? $att: ''?&gt;>&lt;?=anchor('admin', 'admin')?&gt;</li>
    </ul>

Why does every <li> have
Code:
&lt;?= $ci_uri == $this->config->item('FAL_login_uri')? $att: ''?&gt;>&lt;?=anchor($this->config->item('FAL_login_uri'), 'login')?&gt;

I realize that $ci_uri is an object being set, but what is the ? $att: '' for? Also why is substr used?

Thanks for the help!


Messages In This Thread
Can someone please explain this to me - by El Forum - 10-12-2007, 06:28 AM
Can someone please explain this to me - by El Forum - 10-12-2007, 07:07 AM
Can someone please explain this to me - by El Forum - 10-12-2007, 08:20 AM
Can someone please explain this to me - by El Forum - 10-12-2007, 06:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB