/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php 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 .= ' $("#mainContent").prepend(\' <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> <div class="clear_left"> </div>\')'; } // Output JS, and remove extra white space and line breaks $this->EE->javascript->compile(); } /* OR 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');
URL: http://forrst.com/posts/Show_Accessories_only_on_pages_they_need_to_be_use-BJ6