Prev | Current Page 43 | Next

Rob Allen, Nick Lo, and Steven Brown

"Zend Framework in Action"


Zend_View is the View component of the MVC troika and is a fairly simple PHP based template system.
As we have seen, the assign() function is used to pass variables from the main code body to the template which
can then be used within the view template file.
View Template
Finally, we need to provide a view template for our application. This file, index.phtml, is stored within the
views/scripts/index subdirectory. A useful convention that ViewRenderer supplies is to name all view files
with an extension of .phtml as a visual indication that they are for display only. Of course it??™s easily changed
by setting the $_viewSuffix property of ViewRenderer. Even though this is a simple application, we have a
separate directory for each controllers view templates as this will make it much easier to manage as the
application grows. Listing 2.4 shows the view template.
Listing 2.4: The view template: views/scripts/index/index.phtml
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">



<?php echo $this->escape($this->title);?> #1


escape($this->title);?>



Licensed to Menshu You

Pages:
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
sypialnia Hungary Hotels sitemap Dyskusja Nr3 poker online serwis ploterów