Monday 17 July 2006 2:50:00 am
This article describes the template engine included in version 1.1 of eZ components. I analyze a simple application that, using the template engine, queries Google for specified keywords and then checks the rank of a website in the results. While I am not going to describe the entire application (which also uses the eZ PersistentObject component and some more classes), describing the template aspect of the application should give you a good idea of how the eZ Template can be used.
The application follows the MVC pattern, similar to the one described in the Image Gallery article (which described other aspects of the eZ components). There is a main controller that dispatches to several action controllers based on a URL parameter. Rather than analyzing this aspect in detail, we will look at the portion of the main controller that interacts with the template engine.
Each action controller contains the models that are needed to fill in the template variables and tell the main controller which template file to load. Specifically, we will look at the action controller that displays the detailed view of the search containing a list of the results as they are collected.