WikyBlog
Download

Plugins > Admin

Admin Pages are essentially the same thing as Special Pages, the difference being access is restricted to the administrator. It should be noted that admin pages reside in the "Admin" space instead of the "Special" space and as such any links should reflect this.

So instead of

$page->regLink('Hello World'
               ,'/Special/'.$pageOwner['username'].'/'.$wbPluginSpace.'/Hello');
 
echo wbLinks::special($wbPluginSpace.'/Hello','Hello World');
we need
$page->regLink('Hello World'
               ,'/Admin/'.$pageOwner['username'].'/'.$wbPluginSpace.'/Hello');
 
echo wbLinks::admin($wbPluginSpace.'/Hello','Hello World');

Admin Multiple Tabs (2.1)

Using our multiple tabs example in our introduction, we take these changes and turn it into an admin page, remembering to also change out link definitions in links.php.

links.php

<?php
$adminLinks['Hello']['script'] = 'hello.php';
$adminLinks['Hello']['header'] = 'Hello Special';
$adminLinks['Hello']['label'] = '1.3 Hello';
 
$adminLinks['Hello2']['script'] = 'hello.php';
$adminLinks['Hello2']['header'] = 'Hello Special';
$adminLinks['Hello2']['label'] = '1.3 Hello2';

hello.php

<?php
 
global $page,$pageOwner,$wbPluginSpace;
 
// First Hello
$contentUri = $page->regLink('Hello World'
                             ,'/Admin/'.$pageOwner['username'].'/'.$wbPluginSpace.'/Hello');
ob_start();
echo 'Hello World';
echo ' - ';
echo wbLinks::admin($wbPluginSpace.'/Hello2','Hello World2');
$page->contentB[$contentUri] = wb::get_clean();
 
 
// Second Hello
$contentUri = $page->regLink('Hello World2'
                             ,'/Admin/'.$pageOwner['username'].'/'.$wbPluginSpace.'/Hello2');
ob_start();
echo wbLinks::admin($wbPluginSpace.'/Hello','Hello World');
echo ' - ';
echo 'Hello World2';
$page->contentB[$contentUri] = wb::get_clean();

Notes

  • Attempts to access these plugins while not logged in with admin privileges will not display the "Hello World" tabs.

See Plugin 2.1.helloAdmin

Last modified 14:13 Wed, 26 Dec 2007 by Main. Accessed 281 times Children What Links Here share Share Except where expressly noted, this work is licensed under a Creative Commons License.