Posted on: 2013/8/23 17:49
Re: Create a time function
Mamba is correct, you want to have as little coding in your templates as possible.
If you look at templates for your module there should be a PHP portion and a smarty template section.
You setup a series of variables that get passed to smarty and smarty will take it from there and build your display from the template. The logic in Smarty should be very simple and only reference those variables passed to it.
All of the setting up of that variable should be done in your php code and then gets passed to smarty.
Examples of this can be found in just about any major module that uses smarty to build a display.
I did look for a quick and dirty sample but I am not currently coding anything with smarty or templates and it was last year since I have done this so it is a little hard to remember the exact syntax. Plus it will depend on how your module is doing it.
If you are wanting to do this in a theme you will have to add code to the themes PHP file that loads the html files. You will want to make sure the smarty variables are setup before you display any HTML files.
Hopefully this can head you in the right direction. It is very difficult for me to otherwise help you when I don't know what you have that you are starting from or if you are doing this in a theme so it is site wide or just in a module.