Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Small css bug/question
#1
I just wanted to write a top-level plugin which should appear top-level (sry, but the documentation is complicated, the interfaces of register_plugin is not documented: what does $type and $loaddata do?) but, back to the "problem".

Code:
add_action('nav-tab', 'createNavTab', array('myplugin.php','My Plugin'));

adds a new tab in the following way (see plugin_functions.php)

Code:
<li><a href='myplugin.php' class='plugins' />My Plugin</a></li>

if i select the 'plugins' tab now, the tab for my plugin is highlighted, too.

style.css, line 61 says:
Code:
... #plugins .wrapper .nav li a.plugins ... { background: #F9F9F9 none repeat scroll 0 0; }

what should i modify to be sure that not the "Plugins" tab and the "My Plugin" tab gets highlighted at the same time?
Reply
#2
I would recommend the following. be careful: that's not the best option but a workaround for the problem.

1. change the implementation of createNavTab, add the name of the plugin as first parameter
Code:
function createNavTab($plugin, $url,$txt) {
    echo "<li><a href='".$url."' class='".$plugin."' />";
    echo $txt;
    echo "</a></li>";
}

2. add a hook
Code:
add_action('nav-tab', 'createNavTab',     array('myplugin', 'myplugin.php','My Plugin'));
add_action('header',  'mypluginAdminCSS', array());

3. declare a function:
Code:
function mypluginAdminCSS() {
    echo '
    <style type="text/css">
        #myplugin  .wrapper .nav li a.myplugin { color:#182227; background: #F9F9F9; font-weight:bold !important; }
    </style>
    ';
}

this solution is only a workaround! i think, the plugin developer should not take care of the view representation of the tab. the better way would be to take selectors like ... and ...
Code:
.wrapper .nav li.active a
.wrapper .nav li a
Reply
#3
yxcvbnm Wrote:sry, but the documentation is complicated, the interfaces of register_plugin is not documented: what does $type and $loaddata do?
Nothing to apologise for, it really lacks documentation on that point, I didn’t know either. If I recall correctly, but don’t take my word for it, $type tells under what top-level tab the plugin needs to popup and $loaddata what function should be ran when you load the plugins page (that is, when the admin panel loads your plugin.php file).

In the latest SVN build I’m pretty sure neither $type or $loaddata are required any more.

Didn’t know there was a problem with the tabs though, will need to look into why exactly this is happening.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#4
ok, i got that too, now... but, thanks Smile
$type and $loaddata aren't required anymore, but how does it work in future releases?

annotation:
another thread tries to describe a second problem with nav-tab
(see http://get-simple.info/forum/viewtopic.php?id=491)
Reply
#5
Zegnåt Wrote:$type tells under what top-level tab the plugin needs to popup and $loaddata what function should be ran when you load the plugins page

Zegnat is correct here.
yxcvbnm Wrote:$type and $loaddata aren't required anymore, but how does it work in future releases?
These are not required, but they are if you plan on showing an admin page. A plugin like my exec-php one does not need those. My css ones do.

hopefully you are using the latest RC3 to test with, correct?
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply




Users browsing this thread: 1 Guest(s)