Template Packages   How to add an image in the...

How to write smarty code and modify the templates

01 August, 2005 19:20  EasyExpat EasyExpat

A good starting point to learn about Smarty is their crash-course: http://smarty.php.net/crashcourse.php Or if you want more details, a very nice manual is also available: http://smarty.php.net/manual/en/

We give you an example of the template code, in header.template of the easyexpat template:


<tr><td class="orange">{$locale->tr("recently")}</td></tr> {foreach from=$recentposts item=recentpost} <tr class="{cycle values="odd,even"}"><td><a title="{$recentpost->getText()|truncate:150:"..."|strip_tags|escape}" href="{$url->postLink($recentpost)}">{$recentpost->getTopic()}</a><br/> {/foreach}</td></tr>


Here we display all the recent posts. We use truncate to put only the begining of the post. You could also use capitalize to make upper case. You can use plenty of other variables, the list is here.

You can also sort differently the arrays (list of post, messages...) inside the templates by using the method described here: Sorting arrays inside templates.

If you are looking for more help on EasyExpat's blogs, do not forget that we have a dedicated forum.



Add this RSS to Yahoo!    Add this RSS to Google    Add this RSS to Netvibes    Add this RSS feed to your favorites on Technorati

         EasyExpat on