Topics

icon function

{icon} gives you quick access to display an icon and have it act as a button without having to write out the urls yourself.  Here's a snippet:

{icon img='view.png'}

The path to the icon "view.png" will be called, and the html for the image will be written.  It's important to remember to encapsulate the image filename within quotes to be properly processed, otherwise, you will 'break' the template.  Heres a second sample with more parameters:

{icon action=edit record=$items}

You can see that you can give you icons particular actions within the module, title them, give them alt tags, etc.

The 'action' parameter is the controller method to call.  You may force the controller/module if calling outside the current one.  The standard actions of add, edit, delete, view, configure, and manage all automatically pick up the appropriate class and image, but you may also specify the class for non-standard method names:

{icon action=edit_this class=edit record=$items title="Edit this `$modelname`"}

It will generally pick up the action/class as the link text.  To simply display the icon without the test label, pass the action and img without a class:

{icon img="edit.png" controller=users action=edit_group record=$group title="Edit this group"}
Loading Help