blextra Plugin

Compatible with DokuWiki

  • 2012-01-25 "Angua" unknown
  • 2011-05-25 "Rincewind" yes
  • 2010-11-07 "Anteater" unknown

plugin Provide functions for simple template creation

Last updated on
2011-08-22
Provides
Helper
Repository
Source

Tagged with json, links, menu, template

Installation

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

Change Log

Examples/Usage

First of all, init the plugin in your template:

if(!plugin_isdisabled('blextra') && ($blextra =& plugin_load('helper', 'blextra'))) {
  //plugin successfully loaded
}
else {
  echo "ERROR: blextra plugin required!";
}

JSON-encoded menu

You can encode menu links with JSON like:

[
{
  "url":"start",
  "name":"My start page...",
  "more":"id='start'"
},
{
  "url":"nsexample:end",
  "name":"This is the end!",
  "more":""
}
]

You can easyly decode and render your page (menu) with the following steps in your template:

$mymenu = 'data/pages/wiki/menu.txt';
$armenu = json_decode(@file_get_contents($mymenu),true);
if($blextra)
  $blextra->tpl_link_array($armenu,'','');

Get a main menu

You can get a simple main menu as list with the build in type list.

echo "<ul class=\"dokumenu\">";
if($blextra)
  $blextra->tpl_actionlink_array($blextra->available_actions,'<li>','</li>');
echo "</ul>"; //#dokumenu

Only the login link for a anonym user

echo "<ul class=\"dokumenu\">";
 
if($blextra) {
  $types = array(
    array(
      'type' => 'login',
      'pre'  => '',
      'suf'  => '',
      'inner'  => ''
      )
  );
 
  if(isset($_SERVER['REMOTE_USER'])) {
    $types = $blextra->available_actions;
  }
  $blextra->tpl_actionlink_array($types,'<li>','</li>');
}
 
echo "</ul>"; //#dokumenu
plugin/blextra.txt · Last modified: 2011/09/01 12:16 by bernardladenthin
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsGitXRefTranslate