The following warnings occurred:
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message



GetSimple Support Forum
Include loadtab.php in Core - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Feature Requests (http://get-simple.info/forums/forumdisplay.php?fid=7)
+--- Thread: Include loadtab.php in Core (/showthread.php?tid=2112)



Include loadtab.php in Core - mvlcek - 2011-09-07

It would be nice, if the loadtab.php (see e.g. in I18N Gallery plugin) could be installed in the admin directory by default.


Include loadtab.php in Core - ccagle8 - 2011-09-07

whats the purpose of it?


Include loadtab.php in Core - mvlcek - 2011-09-08

It provides the template for displaying the pages on a tab created with the nav-tab action.
Basically a load.php, but with actions pluginname-sidebar and pluginname-sidebar-extra and optionally calling a function based on the item parameter instead of the main function specified on register_plugin.

Currently plugins (e.g. GSGallery, I18N Gallery) copy this file to the admin folder, if it does not exist.


Include loadtab.php in Core - ccagle8 - 2011-09-08

pardon my ignorance, but is nav-tab useless without it?


Include loadtab.php in Core - mvlcek - 2011-09-08

ccagle8 Wrote:pardon my ignorance, but is nav-tab useless without it?

You could link the navigation tab to a php file in your plugins/your-plugin folder, but
  • you would need about the same code (include common.php, header/footer templates, cookie check, etc.)
  • you might get problems, if common.php or templates depend on being called from the admin folder?
  • you must make sure to ALLOW this file in .htaccess
  • it only works with sitewide cookies
  • it's not nice, if the URL suddenly is /plugins/your-plugin/... instead of /admin/...

There are some other problems with side menus and nav tabs:
  • Only one side menu item can be generated using createSideMenu
  • createNavTab is rather useless as it won't highlight the tab
  • a plugin can't (easily) have side menu items on multiple tabs (minor problem in my opinion)

Instead of loadtab.php some small changes will make tabs and side menus (better) usable - see next post.


Include loadtab.php in Core - mvlcek - 2011-09-08

OK, here are the suggested changes:

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 ? '&amp;'.$action : '').'" '.($current ? 'class="current"' : '').' >'.$txt.'</a></li>';
  }
}
$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.
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 ? '&amp;'.$action : '').'" '.($current ? 'class="current"' : '').' >'.$txt.'</a></li>';
}
$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):
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>
If the template to include is not found (as is the case for additional tabs), only the tabname-sidebar action is executed.

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.
My test plugin also includes a condition to determine which tab should be active before register_plugin.
It creates side menu items in Pages and Plugins and a new tab.

I hope you can include this in 3.1!

Martin


Include loadtab.php in Core - mvlcek - 2011-10-11

@ccagle8: will this be included in 3.1?


Include loadtab.php in Core - ccagle8 - 2011-10-12

it's already in the SVN!


Include loadtab.php in Core - mvlcek - 2011-10-12

ccagle8 Wrote:it's already in the SVN!
Great. Thanks!


Include loadtab.php in Core - leenm - 2011-11-13

Checked this topic because http://get-simple.info/forum/topic/2852/default-function-call-of-plugin-with-loadtabphp/

ccagle8 Wrote:it's already in the SVN!

I did a checkout just now, but I can't find the code above in the SVN?


Include loadtab.php in Core - n00dles101 - 2011-11-13

Hi leenm,

mclvek suggested we either add loadtab.php or make the function changes to plugin_function.php and load.php

we have added loadtab.php to the SVN.

Mike.


Include loadtab.php in Core - leenm - 2011-11-13

n00dles101 Wrote:Hi leenm,
we have added loadtab.php to the SVN.
That's even better, but how do I create a sidemenu for my plugin then? The createSideMenu function isn't sufficient:
Code:
unction createSideMenu($id,$txt){
    $class=null;
  if (isset($_GET['id']) && $_GET['id'] == $id) {
        $class='class="current"';
    }
    echo '<li><a href="load.php?id='.$id.'" '.$class.' >'.$txt.'</a></li>';
}
It always uses load.php. Also my point in http://get-simple.info/forum/topic/2852/default-function-call-of-plugin-with-loadtabphp/ still stands then.

I'd like to have this function working properly. I'm willing to propose improvements, but not if this is working already of course. Maybe I'm not understanding how to use the loadtab functionality with a sidemenu properly?


Include loadtab.php in Core - mvlcek - 2011-11-13

n00dles101 Wrote:Hi leenm,

mclvek suggested we either add loadtab.php or make the function changes to plugin_function.php and load.php

we have added loadtab.php to the SVN.

Mike.

Sorry to hear that - I understood that the changes were added, as they provide a much cleaner and better way and allow the plugin developer to easily put his menu items either on an existing tab or a new one.
With just the loadtab.php he has to duplicate the actual code for the adding of menu items in each plugin.

I definitely encourage you to use the other way in the GetSimple core!


Include loadtab.php in Core - leenm - 2011-11-13

Nothing wrong with including loadtab, provided the following changes will be added also:

in loadtab.php (line 25), add:
Code:
# Set default action
if(!isset($_GET['item'])) $_GET['item'] = $plugin_info[$plugin_id]['load_data'];
(this is even better as my solution here: http://get-simple.info/forum/topic/2852/default-function-call-of-plugin-with-loadtabphp/)

change function createSideMenu() to
Code:
function createSideMenu($id,$txt,$pluginid = null){
    $class=null;
    if (isset($_GET['id']) && $_GET['id'] == $id) {
        $class='class="current"';
    } else if ($pluginid && $_GET['item'] == $id) {
        $class='class="current"';
    }
    $url = is_null($pluginid) ? 'load.php?id='.$id : 'loadtab.php?id='.$pluginid.'&item='.$id;
    
    echo '<li><a href="'.$url.'" '.$class.' >'.$txt.'</a></li>';
}
(explanation of extra param $pluginid: When creating a sidemenu for a plugin that is displayed as a new tab with loadtab.php, send the $plugin_id to createSideMenu function.)

Only thing left to fix is styling for the active loadtab tab.


Include loadtab.php in Core - n00dles101 - 2011-11-13

ok, will have a look at the code and add it to the SVN.
Was under the impression it was one or the other.

sorry for the confusion...

8)


Include loadtab.php in Core - mvlcek - 2011-11-13

n00dles101 Wrote:ok, will have a look at the code and add it to the SVN.
Was under the impression it was one or the other.

sorry for the confusion...

8)

Adding loadtab.php was the first approach, but it has a lot of deficiencies, like still needing additional functions for actually adding menu items in the tab.

With the changes described here
  • you can add multiple side menu items for one plugin (e.g. configure and edit) with the standard createSideMenu
  • you can use the same createSideMenu also for items on a new tab
  • you can have menu items that are only visible if the action is active (like "Edit Page" menu item)
  • you don't need loadtab.php by adding a bit of code to load.php

So above changes are the far better solution than adding loadtab.php.


Include loadtab.php in Core - n00dles101 - 2011-12-06

I've updated the latest SVN version with all of these changes.

Any chance you could do a quick wiki on how plugin writers should use it ??


Include loadtab.php in Core - mvlcek - 2012-01-23

n00dles101 Wrote:Any chance you could do a quick wiki on how plugin writers should use it ??

Finally done!


Include loadtab.php in Core - leenm - 2012-01-24

Why is loadtab.php still included (in SVN)? That file isn't needed with mvlcek's changes, right?


Include loadtab.php in Core - n00dles101 - 2012-01-25

@mvlcek, thanks for updating the wiki.

I've moved it into its own page for editing;

http://get-simple.info/wiki/plugins:tabs_menus