- Database Tables and Data
- Module Navigation
- Displaying your Pages
- Common Tasks
- Example Modules
One of the many nice things about using Smarty templates is that you can abstract away logic and content into separate libraries, saving you having to write duplicate code and helping you keep the template file as clean and uncluttered as possible. It helps your templates stay focused as possible on what it should be handling: the appearance and presentation of the data - and not the logic.
For example, say you need to display a "Province/State" dropdown on multiple pages in your module. First, you can write separate PHP function to generate the HTML content, then second, you can write a separate Smarty function file to use that PHP that can be called directly in your templates like so:
All your Smarty functions and modifiers belong in the /smarty subfolder of your module folder. By defining them there, they are automatically accessible to your template pages within your module pages and even within the core script.