/** This is how you instantiate/retrieve the class */ static function getInstance($templateDir = null) { if (self::$instance == null) { $class = __CLASS__; self::$instance = new $class($templateDir); } return self::$instance; }
<?php require_once dirname(dirname(__FILE__)) . '/Homunculus.php'; $hom = Homunculus::getInstance('demo-theme'); $hom->store(array('title' => 'Another Homunculus Page')); $hom->top(); ?> <p>Another page using the Homunculus class.</p> <?php $hom->retrieveFragment('second'); ?> <p><a href="index.php">Return to first page.</a></p> <?php $hom->bottom();
<?php $hom = Homunculus::getInstance(); ?> <footer> <p><a href="https://github.com/soundgnome/homunculus">github repo</a></p> </footer> </div> <?php $hom->htmlInclude('footJS');