How can I set class="active" to navigation menu in codeigniter?

Phearum Chheang

I just start up to be a web developer. Now I create a dynamic website for the first time. I don't know how to set class="active" to the navigation menu. Here is my menu code:

<li>
    <a href="<?php echo base_url(); ?>patient/createpatient"><i class="fa fa-users fa-lg"></i> Create Patient </a>
</li>
<?php } ?>
    <li>
       <a href="<?php echo base_url(); ?>patient/listpatient"><i class="glyphicon glyphicon-list-alt fa-lg"> </i> List Patients </a> 
    </li>
<?php if( $usertype == "Admin"){?>
    <li>
    <a href="<?php echo base_url(); ?>user/"><i class="fa fa-list fa-lg"> </i> List Users </a> 
    </li>`
Nick Berardi

You can use $this->uri->segment();

<li>
    <a href="<?php echo base_url(); ?>patient/createpatient" <?php if($this->uri->segment(1)=="menu_name"){echo 'class="active"';}?> ><i class="fa fa-users fa-lg"></i> Create Patient </a>
</li>
<?php } ?>
    <li>
       <a href="<?php echo base_url(); ?>patient/listpatient" <?php if($this->uri->segment(1)=="menu_name"){echo 'class="active"';}?> ><i class="glyphicon glyphicon-list-alt fa-lg"> </i> List Patients </a> 
    </li>
<?php if( $usertype == "Admin"){?>
    <li>
    <a href="<?php echo base_url(); ?>user/" <?php if($this->uri->segment(1)=="menu_name"){echo 'class="active"';}?> ><i class="fa fa-list fa-lg"> </i> List Users </a> 
    </li>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to make if else menu with active class in codeigniter

From Dev

how to add active class on menu in codeigniter

From Dev

can't set active class in CSS menu

From Dev

How do I add "active" class to dashboard menu button when visiting in CodeIgniter

From Dev

codeigniter, how to call active class to navigation in single page website?

From Dev

KnpMenuBundle - how can i set an icon class to each elements of menu?

From Dev

How to do javascript add class active in LI navigation menu

From Dev

How to do javascript add class active in LI navigation menu

From Dev

Using Express-Handlebars, how can I set an Item to active from my Navigation Bar?

From Dev

How can I make a website navigation menu appear after a set number of seconds?

From Dev

How to set active menu on layout?

From Dev

How to set active to the class

From Dev

How to set active to the class

From Dev

In Bootstrap, how can I identify the "active" navigation element?

From Dev

Click on the navigation dots and it doesnt set the class active

From Dev

Click on the navigation dots and it doesnt set the class active

From Dev

menu li a:active how can I make it working properly?

From Dev

set css active class for current menu

From Dev

Angular: how to create navigation menu where active class gets toggled on click?

From Dev

In CSS, how can I make a navigation menu that overlaps a div?

From Dev

How can i make the horizontal navigation menu center aligned

From Dev

CSS - How can I make a simple navigation menu with submenus?

From Dev

How can I properly position the arrows in my jQuery navigation menu?

From Dev

How Can I Access to Navigation Menu on Existing Activity

From Dev

How to set active navigation item with javascript only?

From Dev

How to add active class to the navigation link in magento?

From Dev

How can I refresh navigation page from left menu master page if navigation page is already on top of the stack?

From Dev

How can I use Active Directory roles to set a controls visibility

From Dev

How can I automatically add a class to a link based on active anchor?

Related Related

  1. 1

    How to make if else menu with active class in codeigniter

  2. 2

    how to add active class on menu in codeigniter

  3. 3

    can't set active class in CSS menu

  4. 4

    How do I add "active" class to dashboard menu button when visiting in CodeIgniter

  5. 5

    codeigniter, how to call active class to navigation in single page website?

  6. 6

    KnpMenuBundle - how can i set an icon class to each elements of menu?

  7. 7

    How to do javascript add class active in LI navigation menu

  8. 8

    How to do javascript add class active in LI navigation menu

  9. 9

    Using Express-Handlebars, how can I set an Item to active from my Navigation Bar?

  10. 10

    How can I make a website navigation menu appear after a set number of seconds?

  11. 11

    How to set active menu on layout?

  12. 12

    How to set active to the class

  13. 13

    How to set active to the class

  14. 14

    In Bootstrap, how can I identify the "active" navigation element?

  15. 15

    Click on the navigation dots and it doesnt set the class active

  16. 16

    Click on the navigation dots and it doesnt set the class active

  17. 17

    menu li a:active how can I make it working properly?

  18. 18

    set css active class for current menu

  19. 19

    Angular: how to create navigation menu where active class gets toggled on click?

  20. 20

    In CSS, how can I make a navigation menu that overlaps a div?

  21. 21

    How can i make the horizontal navigation menu center aligned

  22. 22

    CSS - How can I make a simple navigation menu with submenus?

  23. 23

    How can I properly position the arrows in my jQuery navigation menu?

  24. 24

    How Can I Access to Navigation Menu on Existing Activity

  25. 25

    How to set active navigation item with javascript only?

  26. 26

    How to add active class to the navigation link in magento?

  27. 27

    How can I refresh navigation page from left menu master page if navigation page is already on top of the stack?

  28. 28

    How can I use Active Directory roles to set a controls visibility

  29. 29

    How can I automatically add a class to a link based on active anchor?

HotTag

Archive