Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-23-2008, 10:08 AM
Junior Member
 
Join Date: Mar 2008
Posts: 5
Default Zend framework : complex views with layout , Setting up bootstrapping file

<?php
ob_start();


/*
##
BootStrapping File for the Framework
##
*/


//set the error reports as E_STRICT //

error_reporting(E_ALL|E_STRICT);

// Display all errors //

ini_set('display_errors', true);


//Set Default time zone //

date_default_timezone_set('Europe/London');


//Set application root directory //

$rootDir = dirname(dirname(__FILE__));

//only for local system //

$rootDir = $rootDir."";

//$rootDir . '/Library'. PATH_SEPARATOR . get_include_path();

//add the libraries to the include path for php //

set_include_path($rootDir . '/myapplication/Library'.PATH_SEPARATOR.$rootDir . '/myapplication/Application/models/'. PATH_SEPARATOR . get_include_path());
//Zend Loader Module for loading the classes //

require_once 'Zend/Loader.php';

Zend_Loader :: loadClass('Zend_Debug');
Zend_Loader :: loadClass('Zend_Controller_Front');
Zend_Loader :: loadClass("Zend_Layout");
Zend_Loader :: loadClass('Zend_View');
Zend_Loader :: loadClass('Zend_Registry');
Zend_Loader :: loadClass("Zend_Config_Ini");

$registry = new Zend_Registry();


/*
if a config file present in configs : config ini load the settings for database in test mode //
*/

//not required if other ways are used//

$config = new Zend_Config_Ini("Application/configs/config.ini","test"); //load config : now test mode//



$registry -> set("databaseName",$config->database->name);
$registry -> set("databasePassword",$config->database->password);
$registry -> set("databaseUser",$config->database->user);
$registry -> set("databaseHost",$config->database->host);




//Complex model with new Layouts : give common appearance to application //


$layout = new Zend_Layout();
$layout -> startMvc(array("layoutPath"=>"Application/layouts","layout"=>"main"));
$layout->setInflectorTarget('layouts/:script.:suffix');
$layout -> setViewSuffix('php');

//application layouts//

$view = new Zend_View();
$view -> setScriptPath('Application/views/scripts');

$registry->set('view',$view);



//Dispatch and rotuting to the controller //


$frontController = Zend_Controller_Front::getInstance();
$frontController -> throwExceptions(true);
$frontController -> setControllerDirectory('Application/controllers');
$frontController -> setParam('noViewRender',true);

//Execute run method of the Dispatcher//

$frontController->dispatch();

?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:42 PM.