FUEL CMS User Guide : Version 1.5.2


Asset Helper

This helper allows you to output css, js links and/or files as well as allows you to compress and cache them. Also has convenience methods for paths to assets. It is essentially an alias to the Asset Class.

Function Reference [+]

img_path(['$file'=NULL], ['$module'=NULL], ['$absolute'=NULL])

Returns an image asset path.

Returns

string

Parameters

(string) $file image file name including extension
(string) $module module folder if any
(boolean) $absolute whether to include http://... at beginning

css_path(['$file'=NULL], ['$module'=NULL], ['$absolute'=NULL])

Returns a css asset path.

Returns

string

Parameters

(string) $file css file name (extension not required)
(string) $module module folder if any
(boolean) $absolute whether to include http://... at beginning

js_path(['$file'=NULL], ['$module'=NULL], ['$absolute'=NULL])

Returns a js asset path.

Returns

string

Parameters

(string) $file javascript file name (extension not required)
(string) $module module folder if any
(boolean) $absolute whether to include http://... at beginning

swf_path(['$file'=NULL], ['$module'=NULL], ['$absolute'=NULL])

Returns a swf asset path.

Returns

string

Parameters

(string) $file swf file name (extension not required)
(string) $module module folder if any
(boolean) $absolute whether to include http://... at beginning

pdf_path(['$file'=NULL], ['$module'=NULL], ['$absolute'=NULL])

Returns a pdf asset path.

Returns

string

Parameters

(string) $file pdf file name (extension not required)
(string) $module module folder if any
(boolean) $absolute whether to include http://... at beginning

media_path(['$file'=NULL], ['$module'=NULL], ['$absolute'=NULL])

Returns a media asset path (e.g. quicktime .mov).

Returns

string

Parameters

(string) $file pdf file name including extension
(string) $module module folder if any
(boolean) $absolute whether to include http://... at beginning

docs_path(['$file'=NULL], ['$module'=NULL], ['$absolute'=NULL])

Returns a document asset path (e.g. doc, docx).

Returns

string

Parameters

(string) $file docs file name including extension
(string) $module module folder if any
(boolean) $absolute whether to include http://... at beginning

cache_path(['$file'=NULL], ['$module'=NULL], ['$absolute'=NULL])

Returns a cache asset path.

Returns

string

Parameters

(string) $file cached file name including extension
(string) $module module folder if any
(boolean) $absolute whether to include http://... at beginning

captcha_path(['$file'=NULL], ['$module'=NULL], ['$absolute'=NULL])

Returns a captcha image path.

Returns

string

Parameters

(string) $file captcha file name including extension
(string) $module module folder if any
(boolean) $absolute whether to include http://... at beginning

assets_path(['$file'=NULL], ['$path'=NULL], ['$module'=NULL], ['$absolute'=NULL])

Returns an asset path and is what the others above use.

Returns

string

Parameters

(string) $file asset file name including extension
(string) $path subfolder to asset file (e.g. images, js, css... etc)
(string) $module module folder if any
(boolean) $absolute whether to include http://... at beginning

assets_server_path(['$file'=NULL], ['$path'=NULL], ['$module'=NULL])

Get the server path.

Returns

string

Parameters

(string) $file asset file name including extension
(string) $path subfolder to asset file (e.g. images, js, css... etc)
(string) $module module folder if any

assets_server_to_web_path('$file', ['$truncate_to_asset_folder'=FALSE])

Convert a server path to a web path.

Returns

string

Parameters

(string) $file server path to asset file

asset_exists(['$file'=NULL], ['$path'=NULL], ['$module'=NULL])

Returns a boolean value of whether a file exists.

Returns

boolean

Parameters

(string) $file asset file name including extension
(string) $path subfolder to asset file (e.g. images, js, css... etc)
(string) $module module folder if any

asset_filesize(['$file'=NULL], ['$path'=NULL], ['$module'=NULL], ['$format'=FALSE])

Returns the file size of an asset.

Returns

string

Parameters

(string) $file asset file name including extension
(string) $path subfolder to asset file (e.g. images, js, css... etc)
(string) $module module folder if any
(boolean) $format format

jquery(['$version'='1.7.1'], ['$default'='jquery'])

Creates javascript code that first tries to pull in jquery from the Google CDN, and if it doesn't exist, goes to the local backup version.

Returns

string

Parameters

(string) $version jQuery version number for Google CDN
(string) $default local asset path to default version

js('$path', ['$module'=''], [$options=array()])

Inserts [removed][removed] tags based on configuration settings for js file path.

Returns

string

Parameters

(string) $path file name(s) of the JS files (.css extension is not needed). Can be an array or comma separated list.
(string) $module module module folder if any
(array) $options additional parameter to include (attrs, ie_conditional, and output)

css('$path', ['$module'=''], [$options=array()])

Inserts <link ... /> tags based on configuration settings for css file path.

Returns

string

Parameters

(string) $path file name(s) of the CSS files (.css extension is not needed). Can be an array or comma separated list.
(string) $module module module folder if any
(array) $options additional parameter to include (attrs, ie_conditional, and output)

swf('$flash', '$id', $width, '$height', [$options=array()])

Returns an swf asset path.

Returns

string

Parameters

(string) $flash file name of the swf file including extension
(string) $id module module folder if any
(array) $width additional parameter to include (attrs, ie_conditional, and output)

placeholder(['$width'=100], ['$height'=''], ['$text'=''], ['$colors'=''], ['$img_tag'=FALSE])

Uses the "http://placehold.it" service to display images (good for mocking up sites).

Returns

string

Parameters

(int) $width width of placeholder image (optional)
(int) $height height of placeholder image (optional)
(string) $text text to display inside placeholder
(string) $colors color of placeholder
(boolean) $img_tag determines whether to wrap it in an image tag or just return the path (optional)