Pixelpost

Authentic Photoblog Flavour

ExtendingPixelpost /

Hello World Addon Code

file hello_world.php

<?PHP
// This is a basic example for writing an addon which creates a new tag.
// To see it run save it as "hello_world.php" into your Addons folder.
// Open the Admin Addons page, look out for the Hello World Addon and enter some text here ("Hello World" would be fine).
// Read through these Addon comments and see what happens

// First perform the action of Addons page form
if ($_GET['view']=='addons' && $_GET['say']=='hello') {
         $_SESSION['sayhello'] = $_POST['hello'];
}

// Now the part which has always to be here:
// Addon Name:
$addon_name = 'Hello World Addon';
// Addon Description (we use it for a little form here):
$addon_description = 'This is a sample addon for writing a normal Addon which creates one new template tag:<br />
<strong>&lt;HELLO_WORLD&gt;</strong>.<br /><br />
<form action="'
.$_SERVER['PHP_SELF'].'?view=addons&amp;say=hello" method="post" accept-charset="UTF-8">
<input type="text" size="50" value="'
.($_SESSION['sayhello']?$_SESSION['sayhello']:'Enter a text here, it will be shown instead of the tag &lt;HELLO_WORLD&gt; in your image page').'" name="hello"> <input type="submit" value="Remember">
</form>'
;
// Addon Version:
$addon_version = "0.1";

$hellotext = 'This is my text:<br />'.$_SESSION['sayhello'];
$tpl = str_replace("<HELLO_WORLD>",$hellotext,$tpl);

// All you have to do now is adding the <HELLO_WORLD> tag into one of your template pages, the about_template.html perhaps.
?>

TOP << | ExtendingPixelpost | AvailableSubMenus >>


Page last modified on November 06, 2007, at 05:55 AM