Prev | Current Page 172 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

tpl extension). This is not the only way to store the logic behind
a Smarty design template, but it??™s the way the Smarty documentation recommends at http://
smarty.php.net/manual/en/tips.componentized.templates.php.
The layout and presentation in our project is generated using Smarty design templates.
When a certain component is more complex and needs PHP code to supply it with additional
data or functionality, we use a Smarty componentized template, which is composed of
??? Smarty design template: This is a .tpl file containing HTML and Smarty-specific tags.
For the departments list, the design template is named departments_list.tpl.
??? Smarty plug-in function: The Smarty plug-in function is referenced from the Smarty
design template, and its role is to supply the template with data it needs to display. In
our project, the same Smarty plug-in function (function.load_presentation_object.php)
will be loaded by all Smarty design templates. However, the Smarty plug-in function will
return different results depending on the parameters it is invoked with.
??? Presentation object: This is a class that returns the data required by a Smarty design
template. In the case of the departments list, this class will be named DepartmentsList.
This class reads the list of departments and stores it into a public member that can then
be accessed by the Smarty design template.


Pages:
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184