Search code examples
zend-frameworkzend-view

How do i load a certain view using zend framework?


I'm following the guide to load a view as in this link : http://framework.zend.com/manual/en/zend.view.introduction.html

However, I'm not sure where to keep the booklist.php file that is the view file to be loaded. So, I kept it inside the /views folder (outside the scripts folder)

But, I'm getting this error :

An error occurred

Application error

Please help.


Solution

  • There is this question in the comments at the bottom of that page. 'Steve' says:

    You have to tell it where to find the view script:

    so create the booklist.php file in application/views/scripts/books and insert the line:

    $view->setScriptPath(APPLICATION_PATH.'/views/scripts/books');
    

    after

    $view = new Zend_View();
    

    in your controller script.