The
Request object knows this information and you can access it using its getBaseUrl() function. As we need this
in the view so that we can reference CSS files, we used the SiteTemplate plugin??™s preDispatch() function to
create a new view variable, baseUrl which is just a direct assignment of the output of getBaseUrl(). This
ensures that it is available in the view without having to remember to assign it in every controller action.
The CSS file is similarly simple and the first half controls the layout of the page with the styling of the
elements following. It is available as part of the source code that accompanies this book. As it is served
directly by the web server, we store it within in the web_root directory structure as this is the only area that the
web server can access.
Licensed to Menshu You
Please post comments or corrections to the Author Online forum at
http://www.manning-sandbox.com/forum.jspa?forumID=329
3.4.6 Index.phtml: The action view template
The unique content of the home page is contained within index/index.phtml. As we discussed earlier, we have
automated the location of the action templates based on the controller and action. For our initial home page, we
need to display a title along with the list of places that have recently been updated as shown in listing 3.
Pages:
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115