Location: PHPKode > projects > Weathermap5rrd > weathermap5rrd-1.3.11/docs/module.php
<?php
/* Example module */
class foo extends defaultLib
{
	public $settings;
	private $auto_index = -1;

	function __construct()
	{
		$this->settings = new StdClass;
		$settings = $this->settings;
		/* XML tree represented as an object */
		$settings->xmlobject = new StdClass;
		/* XSL layout to use */
		$settings->layout = "layout.xsl"; // NULL for XML output
		/* XSL layouts to import - array 
		 * $settings->import[0] = new StdClass;
		 * $settings->import[0] = "form.xsl";
		 * result - layout with imported form.xsl;
		 */
		$settings->import = new StdClass;
		/* i'm using this as an in-module index rather than "What was the last 
		 * number i've used?"
		 */
		$this->auto_index = -1;
	}
	function __destruct()
	{
		/* free memory after the work is done */
		unset($this->settings);
	}
	public function init()
	{
		/* this function is called always. it can be said it's controller-module. 
		 * so, you can place some switch here or whatever. when code in module is 
		 * finished, control is given back to parent class which asks for 
		 * $settings and displays output.
		 */
	}
}
?>
Return current item: Weathermap5rrd