You are here: start » plugin_tutorial_admin

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
plugin_tutorial_admin [2013/04/18 13:12]
Christoph M. Becker
plugin_tutorial_admin [2018/10/26 15:33] (current)
Line 21: Line 21:
  
 The if guard is mandatory to avoid that the code is executed, if any action unrelated to your plugin is called. The global $visitors_online is set to '​true'​ by CMSimple_XH,​ if the plugin is called for in the back-end. The if guard is mandatory to avoid that the code is executed, if any action unrelated to your plugin is called. The global $visitors_online is set to '​true'​ by CMSimple_XH,​ if the plugin is called for in the back-end.
 +
 +<​note>​CMSimple_XH 1.6.3 is supposed to introduce the function XH_wantsPluginAdministration() to be used for this guard. It is recommended to use this function instead for future compatibility:​
 +<​code=php>​if (function_exists('​XH_wantsPluginAdministration'​) ​
 +    && XH_wantsPluginAdministration('​visitors_online'​) ​
 +    || isset($visitors_online) && $visitors_online == '​true'​
 +) {
 +    //...
 +}</​code></​note>​
  
 If it's your plugin'​s turn, typically the first thing is to display the plugin menu. The simplest solution is to append the result of print_plugin_admin() to $o. This writes the default plugin menu to the (X)HTML output (actually to the content area). If it's your plugin'​s turn, typically the first thing is to display the plugin menu. The simplest solution is to append the result of print_plugin_admin() to $o. This writes the default plugin menu to the (X)HTML output (actually to the content area).
Line 40: Line 48:
 Now you have to write the function visitors_admin_main() which should return the desired (X)HTML output. If you have the need for several actions (such as displaying a form and handling its submission) you might use the action parameter. This can have an arbitrary value, and you can dispatch on this in visitors_admin_main(). Now you have to write the function visitors_admin_main() which should return the desired (X)HTML output. If you have the need for several actions (such as displaying a form and handling its submission) you might use the action parameter. This can have an arbitrary value, and you can dispatch on this in visitors_admin_main().
  
-<< [[plugin_tutorial_config|Configuration]] | [[plugin_tutorial_javascript|JavaScript]] >>+<< [[plugin_tutorial_config|Configuration]] | [[plugin_tutorial_escaping|Escaping of Strings]] >>
 
You are here: start » plugin_tutorial_admin
Except where otherwise noted, content on this wiki is licensed under the following license: GNU Free Documentation License 1.3
Valid XHTML 1.0 Valid CSS Driven by DokuWiki