Documentation

Functions & Variables

Functions

Asset functions

Use these functions to load assets (CSS, images and JavaScript files) from the assts folder, themes or modules.

{css('file.css', 'modulename')} - Load a CSS file from application/assets/css/ or from a module with the 2nd parameter.

{theme_css('file.css')} - Load a CSS file from the application/themes/x/css/.

{image('image.jpg', 'modulename')} - Load an image file from application/assets/img/ or from a module with the 2nd parameter.

{theme_image('image.jpg')} - Load an image file from the application/themes/x/img/.

{js('file.js', 'modulename')} - Load a JavaScript file from application/assets/js/ or from a module with the 2nd parameter.

{theme_js('file.js')} - Load a JavaScript file from the application/themes/x/js/.

View functions

These functions help you load other view files which will only really be dumb "view fragments".

{theme_view('metadata')} - Load a view file from your theme. Can be handy to break down large complicated layouts into smaller "fragments".

Reserved Variables

There are quite a few variables available to the theme. There are Pyro Variables, Custom variables and Template variables and a few others.

Pyro variables

These are core values used throughout these system for various things.

{$pyro.base_url} - Create a URL to the base of the PyroCMS installation. E.g: http://pyrocms.com/

{$pyro.base_uri} - Create an absolute web path to the base of the PyroCMS installation. E.g: /

{$pyro.application_uri} - Create an absolute web path to the application folder. E.g: /application/

{$pyro.lang} - Holds the current language being used by the system. E.g: en

{$pyro.user.xxx} - Contains user details such as first_name, last_name, id, etc.

{$pyro.server.xxx} - Contains details about the current page request and server, such as SERVER_NAME.

Note: This variable was introduced in PyroCMS v0.9.8-rc2, previously it was {$global.foo}.

Custom variables

These are set in CP > Settings > Variables and are whatever the client sets them as. If you refference a variable in a theme file, page layput, news article, etc that doesnt exist, you'll get an error displayed.

Example: {$variable.somename}

Template variables

{$template.title} - Contains the page title. 

{$template.body} - Output's the main page content. 

{$template.metadata} - A string containing any metadata and general "extra head" content.

{$template.partials.partialname} - Contains an array of HTML chunks for all built partial views.

« Back to "Designers Guide"


Hosted by CloudIgniter
Click here to lend your support to: pyrocms and make a donation at www.pledgie.com !