Welcome Guest, Not a member yet? Register   Sign In
Current page and 'active' class in menu
#1

Hi!

I have a problem, I want set 'active' class to navbar on current page. I tried to something like this but it doesn't work:
PHP Code:
<?=($this->uri->segment(1)==='main/index')?'active':''?>

I have all pages in one controller:
PHP Code:
class Main extends CI_Controller {

    function 
__construct() {
        
parent::__construct();
    }

    public function 
index() {
        
$data['title'] = 'Aktualnoƛci';
        
$this->load->view('templates/web/header'$data);
        
$this->load->view('vrs-pages/index');
        
$this->load->view('templates/web/footer');
    }

    public function 
page_InformacjeTurniej() {
        
$data['title'] = 'O turnieju';

        
$this->load->view('templates/web/header'$data);
        
$this->load->view('vrs-pages/informacje/o-turnieju');
        
$this->load->view('templates/web/footer');
    }

    public function 
page_InformacjeNagrody() {
        
$data['title'] = 'Nagrody';
        
        
$this->load->view('templates/web/header'$data);
        
$this->load->view('vrs-pages/informacje/nagrody');
        
$this->load->view('templates/web/footer');
    }

        
// ETC ...


How can I do this?
Reply


Messages In This Thread
Current page and 'active' class in menu - by vertisan - 06-07-2015, 08:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB