Zend Framework View Path
Posted: Fri Apr 13, 2007 8:53 pm
We'll I've been closely following the PetShop demo thread, and have begun to implement some changes on my own build. However, I've run into a slight problem when using the directory structure proposed in the thread.
Right now I have
My bootstrap sets the filepaths, as suggested in the thread
My view file sets the filepath in the constructor,
However I've gotten an exception saying the view cannot be found, fatal error. When I prepend '/Application/ to the filepath it works fine. Does anyone have any idea why the include path isn't working with my views?
Right now I have
Code: Select all
/Application
bootstrap.php
/Default
/Library
/Zend
/Northern
View.phpCode: Select all
// we locate the application dir via this bootstrap file
$appDir = dirname(__FILE__);
/**
* Include path setup (assuming no facility to edit php.ini)
* Also assumed only Core ZF. Includes the Zps parent directory.
* Left out Models for now.
*/
set_include_path(
$appDir . PATH_SEPARATOR
. $appDir . '/Library' . PATH_SEPARATOR
. get_include_path()
);Code: Select all
public function __construct(Zend_Controller_Request_Http $request, Zend_Session_Namespace $session)
{
$this->setEncoding('utf-8');
$this->setScriptPath($request->getModuleName().'/Views/');
$this->session = $session;
$this->baseurl = $request->getRequestUri();
}