Welcome Guest, Not a member yet? Register   Sign In
Setting active class and selecting specific row from DB
#2

[eluser]richzilla[/eluser]
Codeigniter doesn't use the GET array. Your best to use the function
Code:
$this->uri->segment(segment_number)
What this does is return the value of the segment number you entered, for example with the url
Code:
www.mysite.com/index.php/admin/posts/view/123

admin would be segment(1), posts segment(2) and so on. So after your controller and function names, put any variables for your page as url segments.

In terms of marking selected pages as the current page, javascript is is your best option. Give all of the links in your navigation bar an id that matches the page id you've allocated for every page.

Then in your controller for the page:

Code:
$data['page_id'] = 'page_id';
$this->load->view('my_view',$data);

Then with jquery (or normal javascript) have a function similar to this:
Code:
$("a#<?php echo page_id; "?>").addClass('current');

This will add the class 'current' to the link thats currently being viewed, and from there you can use css to make it look however you want.


Messages In This Thread
Setting active class and selecting specific row from DB - by El Forum - 02-06-2010, 05:06 AM
Setting active class and selecting specific row from DB - by El Forum - 02-06-2010, 06:24 AM
Setting active class and selecting specific row from DB - by El Forum - 02-06-2010, 06:27 AM
Setting active class and selecting specific row from DB - by El Forum - 02-06-2010, 06:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB