Login   Register  
PHP Classes
elePHPant
Icontem

File: index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of None  >  PHP Controller  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: an example index.php file
Class: PHP Controller
Implements a controller of MVC applications
Author: By
Last change:
Date: 9 years ago
Size: 1,382 bytes
 

Contents

Class file image Download
<?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");

?>