Felix
June 26, 2015, 2:57pm
1
I want to add a small icon to the left of the documentation icon at the top right, that will have a mouse-over effect displaying the username of the connected user. I found out that I can do that by editing the file
/application/modules/layout/views/layout.php
So, under
<ul class="nav navbar-nav navbar-right">
I added the code:
<li>
<a href="#" class="tip icon" data-original-title="<?php echo XXX; ?>"
data-placement="bottom">
<i class="fa fa-question-circle"></i>
<span class="visible-xs"> <?php echo XXX; ?></span>
</a>
</li>
but I don’t know how to reference the variable user_name
and put it instead of XXX.
Kovah
June 26, 2015, 3:55pm
2
You could try this but I’m not sure if its working.
Felix
June 26, 2015, 4:41pm
3
Thank you Kovah! This helped a lot!
The variable is:
$this->session->userdata('user_name')
Here is the complete code snippet:
<li>
<a href="#" class="tip icon" data-original-title="<?php echo $this->session->userdata('user_name'); ?>" data-placement="bottom">
<i class="fa fa-question-circle"></i>
<span class="visible-xs"> <?php echo $this->session->userdata('user_name'); ?></span>
</a>
</li>
And here is the result
Or even better…
With code:
<li>
<a href="#" class="tip icon" data-original-title="<?php echo $this->session->userdata('user_name'); ?>" data-placement="bottom">
<i class="fa fa-user"></i>
<span class="visible-xs"> <?php echo $this->session->userdata('user_name'); ?></span>
</a>
</li>
2 Likes