Welcome Guest, Not a member yet? Register   Sign In
Keeping parent menu items active in child pages
#6

(This post was last modified: 12-18-2014, 05:18 AM by InsiteFX.)

This is how I sat the active state in a helper file, I' am sure you can add a new method for the child pages.

PHP Code:
/**
 * ------------------------------------------------------------------------
 * active_link()
 *
 * Sets the active links
 *
 * Usage HTML Code:
 *
 * <li <?php echo active_link('Welcome');?>>
 *
 * @access    public
 * @param    string
 * @return    string
 */
if ( ! function_exists('active_link'))
{
    function 
active_link($controller)
    {
        
$_ci get_instance();
        
$class $_ci->router->fetch_class();
        return (
$class == $controller) ? ' class="active"' '';
    }


active_link is your page name.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: Keeping parent menu items active in child pages - by InsiteFX - 12-18-2014, 05:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB