The final step is fetching the data. In this tutorial we are using the default Smarty engine (as seen in the template file) so to fetch this data we will use the {includeView} custom function (for PHP the view getControllerView() method needs to be called).
This function (and the method) take the following parameters:
Additionally; if any other parameters are passed through they will be passed into the requested view (in PHP these must be specified as a string of parameters e.g. param1=value1¶m2=value2).
Open the home.html.tpl file and then within a new div (or however you want to handle it, and the following:
{includeView controller=guestbook path='/guestbook' view=top5}
Save the changes, and refresh your browser. You should now see the guestbook entries (if you had any to display!).
There are many other examples of this throughout the baseAdminSite. Any number of additional views can be created. Simply update the controller and views and add any additional model logic to handle what you wish to do. Remember that the controller, path and view are always required when including a controller view to help route the request. Additionally, avoid placing any rendering into the model or controller. This will help keep your system clean and ensure that the view context is preserved.
Download the basic files as a Zip file.
Posted by: Dave Redfern (Writer), in Tutorials on 08 Jul 2008 @ 19:50
Tags: information, tutorial, views,
Contents:
Related Articles
This
work is licenced under a
Creative Commons Licence.