Location: PHPKode > scripts > PHP Controller > php-controller/index.php
<?php
// PHP-CONTROLLER EXAMPLE
// Load Database Settings 
session_start();
require_once('PEAR.php');
$dbconfig = parse_ini_file('dataobjects.ini', true); 
foreach ($dbconfig as $class => $values) { 
    $options = &PEAR::getStaticProperty($class, 'options'); 
    $options = $values; 
} 


//this is all the code we need to load up proper classes
require_once('Controller.class.php');
$controller = new Controller("controller.xml");
$controller->setDebugLevel(4);
$controller->performAction();
$templateName = $controller->getTemplateName();
$sectionName   = $controller->getSectionName();
$methodName   = $controller->getMethodName();
$pageContent  = $controller->getContent();
$domain =  $controller->getDomainName();


//this should probably be inside a smarty manager class
require_once('Presentation/Smarty-2.6.9/Smarty.class.php');
$smarty = new Smarty();
$smarty->template_dir = "Presentation/templates/";
$smarty->compile_dir  = "Presentation/templates_c/";
$smarty->cache_dir    = "Presentation/cache/" ;
$smarty->config_dir   = "Presentation/config/";

//now we handle the information from controller to template engine. easy?
$smarty->assign("domain", $domain );
$smarty->assign("section", $sectionName );
$smarty->assign("method", $methodName );
$smarty->assign("content", $pageContent);
$smarty->display("$templateName.tpl");

?>
Return current item: PHP Controller