Jump to content

Add custom icon images to left menu

From NusaATK
Revision as of 04:31, 22 November 2007 by Jgarifuna (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Summary

Starting from ATK 6.2 a new feature has been added to ATK by Lineke to include icon images to the left menu items. Below I intend to show how to take advantage of this new feature to beatify the left menu of ATK applications.


Requirements

ATK 6.2+

If this version is not officially released at the time of this reading, you may download the latest nightly build after November 21, 2007 from:

[1]


Implementation

1. Create theme directory within your module:

yourModule/themes/default/icons/menu

2. Create the “themedef.inc” file within the default directory so you have:

yourModule/themes/default/themedef.inc

3. Add the following code to the newly create “themedef.inc” file:

<?php

  $theme["menu_icons"] = 'icons/menu/';

?>

4. Add your icons to the “menu” directory so you have:

yourModule/themes/default/icons/menu/yourModule_menuLabel.png

For example, if you had a module called “Garifuna” and a menu item with the display label “software”, your icon should be named “Garifuna_software.png” or “Garifuna_software.jpg” or “Garifuna_software.gif”. The above path would now look like:

yourModule/themes/default/icons/menu/Garifuna_software.png

From the examples above, we can see that there are three formats supported: Png Jpg Gif

5. Modify menu.tpl

Replace:

 {if (count($menuitem.submenu)>0)}
 {/if}

With:

 {if (count($menuitem.submenu)>0)}
 {/if}

The menu.tpl file is located at:

atk\themes\YourTheme\templates\menu.tpl

6. Clear the theme cache

Remove all temporary theme files from:

atktmp\themes

7. Test your icons

To test your icons, reload the left menu and if everything was done right, you should be able to see the icons next to the menu item.

Until next time,

Jorge Garifuna [2]