Return to Snippet

Revision: 37519
at December 11, 2010 07:14 by audiopleb

Initial Code

function set_sections()
        // Remove the tab. This is lame.
        $script = '
            $("#'. $this->id .'.accessory").remove();
            $("#accessoryTabs").find("a.'. $this->id .'").parent("li").remove();
// Only show this on 1 page of the CP
        if($this->EE->input->get('C') == 'members' AND $this->EE->input->get('M') == 'view_all_members')
            $script .= '
                    <div class="rightNav"> 
                        <div style="float: left; width: 100%;"> 
                                <span class="button"><a title="Export Members" class="submit" href="'.BASE.AMP.'C=addons_accessories'.AMP.'M=process_request'.AMP.'accessory=member_export'.AMP.'method=process_export">Export Members</a></span> 
                        <div class="clear_left">
        // Output JS, and remove extra white space and line breaks
        $this->EE->javascript->output('$(function(){'. preg_replace("/\s+/", " ", $script) .'});');


In the install of your Accessory/Extension, update it's controller field, 
so it only shows in that controller, then the hide tab script above never runs unless needed, 
and your hidden tab does not flash.

$this->EE->db->where('class', 'My_cool_acc');
            $this->EE->db->update('accessories', array('controllers' => 'admin_content'));

Initial URL

Initial Description

Initial Title
ExpressionEngine Accessories only on certain pages

Initial Tags
javascript, php, jquery

Initial Language