The following view code produces html code as follows.
Q1. what is the first line doing?
<?php $ci_uri = trim($this->uri->uri_string(), '/'); $att = ' id="active"';?>
Q2. Why
producing id="active"?
Q3. What are the purpose of
<?= substr($ci_uri, 0, 7) == 'example'? $att: ''?>
<?= $ci_uri == $this->config->item('FAL_login_uri')? $att: ''?>
...
...
<?= $ci_uri == $this->config->item('FAL_changePassword_uri')? $att: ''?>
etc.
Is it using ternary operator?
View code
<?php $ci_uri = trim($this->uri->uri_string(), '/'); $att = ' id="active"';?>
<ul id="navlist">
<li<?= $ci_uri == ''? $att: ''?>><?=anchor('', 'home')?></li>
<li<?= substr($ci_uri, 0, 7) == 'example'? $att: ''?>><?=anchor('example', 'examples')?></li>
<li<?= $ci_uri == $this->config->item('FAL_login_uri')? $att: ''?>><?=anchor($this->config->item('FAL_login_uri'), 'login')?></li>
<li<?= $ci_uri == $this->config->item('FAL_register_uri')? $att: ''?>><?=anchor($this->config->item('FAL_register_uri'), 'register')?></li>
<li<?= $ci_uri == $this->config->item('FAL_forgottenPassword_uri')? $att: ''?>><?=anchor($this->config->item('FAL_forgottenPassword_uri'), 'forgotten password')?></li>
<li<?= $ci_uri == $this->config->item('FAL_changePassword_uri')? $att: ''?>><?=anchor($this->config->item('FAL_changePassword_uri'), 'change password')?></li>
<li<?= substr($ci_uri, 0, 5) == 'admin'? $att: ''?>><?=anchor('admin', 'admin')?></li>
</ul>
HTML code
<ul id="navlist">
<li id="active"><a href="http://127.0.0.1/ci_freak_auth/index.php">home</a></li>
<li><a href="http://127.0.0.1/ci_freak_auth/index.php/example.html">examples</a></li>
<li><a href="http://127.0.0.1/ci_freak_auth/index.php/auth/login.html">login</a></li>
<li><a href="http://127.0.0.1/ci_freak_auth/index.php/auth/register.html">register</a></li>
<li><a href="http://127.0.0.1/ci_freak_auth/index.php/auth/forgotten_password.html">forgotten password</a></li>
<li><a href="http://127.0.0.1/ci_freak_auth/index.php/auth/changepassword.html">change password</a></li>
<li><a href="http://127.0.0.1/ci_freak_auth/index.php/admin.html">admin</a></li>
</ul>