WikyBlog
Download

Plugins > Special

Special pages in WikyBlog are likely the easiest way to create a plugin.

Getting Started

To get started you'll need the following.

  1. Create the folder 1.1.helloSpecial in your plugins directory.
  2. Create the files hello.php and links.php in the new folder.
  3. Open each of these files in a text editor like Notepad and add the following content

Hello World (1.1)

links.php

<?php
$specialLinks['Hello']['script'] = 'hello.php';
$specialLinks['Hello']['header'] = 'Hello Special';

hello.php

<?php
message('Hello World');

See Plugin 1.1.helloSpecial

Then install your new plugin from the "Manage Plugins" script found in the administrator's control panel. Once installed, you'll see a new link in the user control panel for your plugin.

Hello With Tabs (1.2)

As you probably noticed, the previous script only ouputs a message and doesn't make use of the tabbed interface. To make use of this feature, we'll need to access a few global objects: $page and $pageOwner.

  1. Create the folder 1.2.helloSpecial in your plugins directory.
  2. Create the files hello.php and links.php in the new folder.
  3. Open each of these files in a text editor like Notepad and add the following content

links.php

<?php
$specialLinks['Hello']['script'] = 'hello.php';
$specialLinks['Hello']['header'] = 'Hello Special';

hello.php

<?php
global $page,$pageOwner,$wbPluginSpace;
$contentUri = $page->regLink('Hello World',
                             '/Special/'.$pageOwner['username'].'/'.$wbPluginSpace.'/Hello');
ob_start();
echo 'Hello World';
$page->contentB[$contentUri] = wb::get_clean();

Notes

  • Once installed there will again be a link in the user control panel.
  • The variables $page->contentB and $page->regLink have an important relationship.
  • We use ob_start() wb::get_clean() to capture echo statements.

See Plugin 1.2.helloSpecial

Multiple Tabs (1.3)

Here's an example of multiple tabs. Notice that the $page->regLinks values not only have different indexes, but also different values. We've also added the label values to the links.php file.

links.php

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

hello.php

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

Notes

  • We used wbLinks::special(..) to create a link to the special pages. wbLinks::local(..) can also be used: wbLinks::local('/Special/'.$pageOwner['username'].'/'.$wbPluginSpace.'/Hello2','Hello World2').

See Plugin 1.3.helloSpecial

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