From Pixelpost

ExtendingPixelpost: AdminHelloWorldAddon

Admin Hello World Addon Code

file admin_hello_world.php

// This is a basic example for several methods of including admin addon functions into existing and new pages.
// To see it run save it as "admin_hello_world.php" into your Addons folder.
// Open the Admin Addons page, look out for the Admin 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 = 'Admin Hello World Addon';
// Addon Description (we use it for a little form here):
$addon_description = 'This is a sample addon for creating a Hello World Menu and a few Hello World Submenus.<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 on the Hello World Page').'" name="hello"> <input type="submit" value="Remember">
// Addon Version:
$addon_version = "0.1";

// Just always remember the Admin Interface function:
// add_admin_functions($addon_function_name,$addon_workspace,$addon_menu,$addon_admin_submenu);

// First we use the Admin Interface to place the Helloworld text into an existing page, the General Info page for example:
// have a look into the General Info page now!

// Now we want to create a new submenu page to an existing menu entry, the Options page perhaps:
// add_admin_functions($addon_function_name,$addon_workspace,$addon_menu,$addon_admin_submenu);
// great fun, isn't it?

// Last thing we create is a brand new menu page for our Hello World:
// and fill it with content:
// hey, that is cool!

function say_hello()
        echo "<div id='cropdiv'>
                <table width='300' height='50' border='1' cellpadding='10' cellspacing='0' bordercolor='red' align='center'>
                <br />
}// end function
Retrieved from
Page last modified on November 06, 2007, at 05:56 AM