mimetype_icon

Summary

Converts a MIME-Type string into an icon.

Usage

$input_string|mimetype_icon( [size], [alt_text], [return_uri] )

Parameters

NameTypeDescriptionRequired
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

Returns

An <img> tag used to display the MIME-Type icon or the path to the icon file

Description

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.

Examples

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

Contents

Reference

Database diagram
Template operators
    PDF
    Arrays
    Data extraction
    Formatting
    Images
    Logic
    Mathematics
    Miscellaneous
    Strings
       mimetype_icon
       append
       begins_with
       break
       ord
       compare
       concat
       contains
       count_chars
       count_words
       crc32
       downcase
       ends_with
       explode
       extract
       extract left
       extract_right
       indent
       insert
       md5
       nl2br
       chr
       pad
       prepend
       remove
       repeat
       reverse
       rot13
       shorten
       simplify
       trim
       upcase
       upfirst
       upword
       wash
       wordtoimage
       wrap
    URLs
    Variables
Template functions
Data fetching
Modules
XML tags


Created

26/03/2004
11:18:29 am
by Bård Farstad

Last updated

17/11/2004
7:55:31 pm
by Jan Borsodi

Authors

Bård Farstad
Jan Borsodi



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.