2011-09-08, 06:06:03
OK, here are the suggested changes:
plugin_functions.php / createSideMenu:
replace it with the following (compatible) code:
$action will add an additional request parameter thus allowing multiple side menu items per plugin.
Setting $always to false will only show the menu item, if the page is active ($action should be non-empty)
plugin_functions.php / createNavTab:
Not compatible, but I doubt that anybody uses it.
$tabname is the name of the tab (e.g. "special"), the action for creating side menu items is the name of the tab plus "-sidebar" (e.g. "special-sidebar"), analog to the standard tabs (e.g. "pages-sidebar").
Other parameters like for createSideMenu.
To highlight the tab, add the following to the CSS (or rather add the selector to the already existing rule for highlighting):
load.php:
Replace the <div id="sidebar"> ... </div> code with:
If the template to include is not found (as is the case for additional tabs), only the tabname-sidebar action is executed.
Attached:
It creates side menu items in Pages and Plugins and a new tab.
I hope you can include this in 3.1!
Martin
plugin_functions.php / createSideMenu:
replace it with the following (compatible) code:
Code:
function createSideMenu($id, $txt, $action=null, $always=true){
$current = false;
if (isset($_GET['id']) && $_GET['id'] == $id && (!$action || isset($_GET[$action]))) {
$current = true;
}
if ($always || $current) {
echo '<li><a href="load.php?id='.$id.($action ? '&'.$action : '').'" '.($current ? 'class="current"' : '').' >'.$txt.'</a></li>';
}
}
Setting $always to false will only show the menu item, if the page is active ($action should be non-empty)
plugin_functions.php / createNavTab:
Not compatible, but I doubt that anybody uses it.
Code:
function createNavTab($tabname, $id, $txt, $action=null) {
global $plugin_info;
$current = false;
if (basename($_SERVER['PHP_SELF']) == 'load.php') {
$plugin_id = @$_GET['id'];
if ($plugin_info[$plugin_id]['page_type'] == $tabname) $current = true;
}
echo '<li><a href="load.php?id='.$id.($action ? '&'.$action : '').'" '.($current ? 'class="current"' : '').' >'.$txt.'</a></li>';
}
Other parameters like for createSideMenu.
To highlight the tab, add the following to the CSS (or rather add the selector to the already existing rule for highlighting):
Code:
<style type="text/css">
#load .wrapper .nav li a.current {
-moz-box-shadow: 2px -2px 2px rgba(0, 0, 0, 0.1);
background: -moz-linear-gradient(center top , #FFFFFF 3%, #F6F6F6 100%) repeat scroll 0 0 transparent;
color: #182227;
font-weight: bold !important;
text-shadow: 1px 1px 0 #FFFFFF;
}
</style>
load.php:
Replace the <div id="sidebar"> ... </div> code with:
Code:
<div id="sidebar" >
<?php
$res = (@include('template/sidebar-'.$plugin_info[$plugin_id]['page_type'].'.php'));
if (!$res) {
?>
<ul class="snav">
<?php exec_action($plugin_info[$plugin_id]['page_type']."-sidebar"); ?>
</ul>
<?php
}
?>
</div>
Attached:
- loadext.php - the copied and patched load.php for my test
- i18n_specialpages.php - a test of the changes, using functions createSideMenuExt, createNavTabExt, adding the css rule in a header action and calling loadext.php instead of load.php.
It creates side menu items in Pages and Plugins and a new tab.
I hope you can include this in 3.1!
Martin