ez.no / exponential / documentation / reference / template operators / strings / mimetype_icon
$input_string|mimetype_icon( [size], [alt_text], [return_uri] )
| Name | Type | Description | Required |
|---|---|---|---|
| size | identifier | The size of the icon | no |
| alt_text | string | Text string to use as alternative text and tooltip | no |
| return_uri | boolean | Whether to return XHTML code or just the icon path | no |
An <img> tag used to display the MIME-Type icon or the path to the icon file
Note: this operator was added in Exponential 3.4.
If size is not supplied it will use the default size defined in icon.ini. The size is an identifier and must be defined in the Sizes INI variable in icon.ini. Typical size identifiers are small, normal, large.
If return_uri is set to true then it will only return the path of the icon file, you will then have to make the XHTML code yourself.
Passing alt_text while return_uri is set to true will not work, the string will be ignored.
The icon that will be used is defined by the current icon theme in use. The theme is controlled by the global Theme INI variable in icon.ini. It is also possible to set a theme for only MIME-Types by setting Theme in the MimeIcons INI group.
Show a PDF icon:
{"application/pdf"|mimetype_icon( small )}
Show a PDF icon with alternative text:
{"application/pdf"|mimetype_icon( small, 'PDF file' )}
Show a PDF icon and generate HTML code yourself:
<img src={"application/pdf"|mimetype_icon( small,, true() )|ezurl} />PDF file
Comments