Zend_view doubts in zendframework I felt strange when using zend_view: when using a script file, classPutpostControllerextendsZend_Controller_Action {& nbsp; functionindexAction () & nbsp ;{& nbsp; zend_view in Zend_Lo zend framework
The strange thing I felt when using zend_view is that when using a script file,
Class PutpostController extends Zend_Controller_Action
{
Function indexAction ()
{
// Zend_Loader: loadClass ('zend _ view ');
$ View = new Zend_view ();
$ View-> setScriptPath ('./application/views/scripts/posts'); // Directory of the view script
Foreach ($ view-> getScriptPaths () as $ onepath)
{
Echo $ onepath .'
';
}
$ View-> render ("postnews. phtml ");
}
}
After I set this script directory and set the phtml file, we should use this template to complete the output. However, when I run http: // localhost: 8082/putpost, it prompts that I cannot find the script.
Fatal error: Uncaught exception 'zend _ View_Exception 'with message 'script' putpost/index. phtml' not found in path (. \ application \ views \ scripts \)'
It seems that the default path is still used. Then I intentionally setScriptPath to a non-existent directory, but reminded me that my path does not exist. that is to say, I still need to set the path? In this case, why can't I specify my own file? it must follow the default putpost/index. phtml to search (it is useful after I put files in this directory, but it is based on index. phtml is used to output messages instead of postnews. phtml.
Is there another way to define a view in action? if I use echo directly without creating a template, it does not work. I still keep reminding me that putpost/index. phtml does not exist?
Is zend_view and script used in this way?
------ Solution --------------------
Can you not add the ../application/views/scripts/posts?
------ Solution --------------------
Top
------ Solution --------------------
Can you not add the ../application/views/scripts/posts?