Using the module template class

From Sohowiki
(Difference between revisions)
Jump to: navigation, search
(Required module class directives)
Line 63: Line 63:
 
$module->icon_img = "skins/".$_SESSION['skin']."/icons/full_size/create_pages-enabled.gif";
 
$module->icon_img = "skins/".$_SESSION['skin']."/icons/full_size/create_pages-enabled.gif";
 
$module->heading_text = "Create New Pages";
 
$module->heading_text = "Create New Pages";
$module->description_text = "You may create up to 10 new pages at a time.Please only use alpha-numerical characters and spaces.";
+
$module->description_text = "You may create up to 10 new pages at a time.";
 +
$module->description_text .= "Please only use alpha-numerical characters and spaces.";
 
$module->good_to_go();</pre>
 
$module->good_to_go();</pre>

Revision as of 17:49, 3 May 2007

Contents

Disclaimer

This page is intended for php-literate developers who are already familiar with building plugins for Soholaunch Pro Edition. Until this sentence is removed, this page is under construction and will mainly be a reference for advanced developers.

Introduction

The module template class makes it easy for you as the plugin developer to create management modules in the Soholaunch admin tool (i.e. linked to off the Main Menu) that have the same look and feel as the rest of the admin tool --- even if we (Soholaunch) make changes to that look and feel your plugin will automatically reflect the changes without you having to do anything.

Sample module file

Start by making a copy of this file to serve as the foundation for your admin module...

sohoadmin/program/modules/sample_module.php

Contents of sample_module.php

<?php
error_reporting(E_PARSE);
if($_GET['_SESSION'] != '' || $_POST['_SESSION'] != '' || $_COOKIE['_SESSION'] != '') { exit; }

#=====================================================================================
# Soholaunch(R) Site Management Tool
#
# Author:        Mike Morrison
# Homepage:      http://www.soholaunch.com
# Release Notes: http://wiki.soholaunch.com
#
# This Script: Simple example module to illustrate how to create a new
# module and keep it's look consistent with the rest of the product
#=====================================================================================

error_reporting(E_PARSE);
session_start();

# Include core files
include_once($_SESSION['docroot_path']."/sohoadmin/program/includes/product_gui.php");
include_once($_SESSION['docroot_path']."/sohoadmin/program/includes/smt_module.class.php");

# So you can write straight HTML without having to build every line into a container var (i.e. $disHTML .= "another line of html")
ob_start();

?>


<!---Module html goes here-->
Module html goes here.


<?
# Grab module html into container var
$module_html = ob_get_contents();
ob_end_clean();

# Note: "Create Pages" used for example purposes. Replace with your own stuff.
$module = new smt_module($module_html);
$module->add_breadcrumb_link("Create New Pages", "program/modules/create_pages.php");
$module->icon_img = "skins/".$_SESSION['skin']."/icons/full_size/create_pages-enabled.gif";
$module->heading_text = "Create New Pages";
$module->description_text = "You may create up to 10 new pages at a time.Please only use alpha-numerical characters and spaces.";
$module->good_to_go();
?>

Required module class directives

This should go at the bottom of the php file for your admin module.

$module = new smt_module($module_html);
$module->add_breadcrumb_link("Create New Pages", "program/modules/create_pages.php");
$module->icon_img = "skins/".$_SESSION['skin']."/icons/full_size/create_pages-enabled.gif";
$module->heading_text = "Create New Pages";
$module->description_text = "You may create up to 10 new pages at a time.";
$module->description_text .= "Please only use alpha-numerical characters and spaces.";
$module->good_to_go();
Personal tools