====== blextra Plugin ====== ---- plugin ---- description: Provide functions for simple template creation author : Bernard Ladenthin email : bernard@ladenthin.net type : helper lastupdate : 2012-05-26 compatible : 2011-04-22, 2011-05-25, 2012-01-25a depends : conflicts : similar : tags : json links menu template downloadurl: https://github.com/bernardladenthin/dokuwiki-plugin-blextra/zipball/master bugtracker : https://github.com/bernardladenthin/dokuwiki-plugin-blextra/issues sourcerepo : https://github.com/bernardladenthin/dokuwiki-plugin-blextra/ donationurl: ---- Compatible: * 2011-04-22 * 2011-05-25 * 2012-01-25a ===== Installation ===== Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually. ==== Change Log ==== {{rss>https://github.com/bernardladenthin/dokuwiki-plugin-blextra/commits/master.atom date}} ===== 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 ""; //#dokumenu === Only the login link for a anonym user === echo ""; //#dokumenu