Icon packages

by Elxis Team

Get icons from an icon package or create your own package

Elxis uses a number of icons in various places of the CMS (mostly in the administration console). These icons are organized into packages and by size. The site's administrator can select the pack he wishes to use. Elxis comes with the nautilus icons pack but you can install more. All images are of type PNG and they are available in the following dimensions: 16x16, 24x24, 32x32 and 64x64.

Get icons

To get an icon use the icon method of the elxisFramework class.

public function icon($name, $size=16, $pack='')
  • $name Is the file's name without the extension png.
  • $size The size of the icon (16, 24, 32 or 64)
  • $pack The icon's pack name. Leave empty for the default pack (recommended).

Sample usage

$elxis = eFactory::getElxis();
$icon = $elxis->icon('settings', 32);

The above will return the full URL to the settings.png image having dimensions 32x32 and of the current icon's pack.

If you wish to force select an image from an other than the current icon pack (not recommended) set properly the pack's name in the third parameter of the method:

$icon = $elxis->icon('settings', 32, 'otherpack');

If the image does not exist in a package Elxis will return the same image for the default icons pack (nautilus) and even if this does not exist it will return a default image (not_found.png).


Create a new icons pack

Let's say you wish to create a new icons package named nature. Create these folders:

includes/icons/nature/
includes/icons/nature/16x16/
includes/icons/nature/24x24/
includes/icons/nature/32x32/
includes/icons/nature/64x64/

Place your custom icons inside these folders keeping the same names as the default icons pack nautilus. The site's administrator will be able to pick this icons pack from Elxis general configuration page.


It has been read 4496 times
Observer
Previous article
Observer
Dependencies
Next article
Dependencies

You are free to copy, distribute and transmit the articles in this site for non-commercial purposes.
Creative Commons 3.0