Understanding Fruml Tags
Fruml Tags provide the mechanism whereby Fruml adds content into your templates. A tag amost always contains a `name` attribute which is used to identify the content being requested by the tag, and any number of optional attributes used to influence the manner in which the output of the tag is rendered. The following list shows the available tags and the attributes they can use. The order in which the tags are presented here represents the order in which they are parsed when a page is rendered (although this order can be edited in the 'Content Providers' functionality within Fruml).
The following tags are available:
[setting name="setting_name"]
The setting tag is used to write the value of system settings into the page. An example here might be:
<p>Send your e-mails to: <a href="mailto:[setting name="mail_sender_address"]">[setting name="mail_sender_name"]</a>. No spam please!</p>
This would output something similar to:
<p>Send your e-mails to: <a href="mailto:bob@example.com">Bob</a>. No spam please!</p>
Attributes available for this tag:
- name
Used to identify the setting to return
- transform
Used to apply text transformations to the output returned by the tag. Multiple transform attributes can be supplied and are executed in the order in which they appear in the tag
- cache
Used to define if the output of the tag is cached
[page name="field_name"]
The page tag outputs a bit of page content. The fields available are all the standard content fields as well as all custom fields assigned to the page's page type.
<!DOCTYPE html>
<head>
<title>[page name="page_title"]</title>
</head>
<body>
[page name="page_content"]
</body>
</html>
The example displayed above outputs the `page_title` and `page_content` fields. Depending on the type of content stored in field, additional text or image transformations can be applied.
Attributes available for this tag:
- name
Used to identify the page content field to return
- transform
Used to apply text transformations to the output returned by the tag. Multiple transform attributes can be supplied and are executed in the order in which they appear in the tag
- cache
Used to define if the output of the tag is cached
- parseonpass
An optional tag that can be used to influence the rendering order of Fruml tags
[plugin name="plugin" method="method"]
This tag calls a plugin and is replaced by the output returned from the method called on the plugin.
If you wish, the function can be used as an alias of the method attribute ([plugin name="plugin" function="method"]). Any other attributes in the Fruml tag are passed to the method as an associative array.
Attributes available for this tag:
- name
The name of the plugin to call
- method/ function
The name of the method to call on the plugin
- transform
Used to apply text transformations to the output returned by the tag. Multiple transform attributes can be supplied and are executed in the order in which they appear in the tag
- cache
Used to define if the output of the tag is cached
- parseonpass
An optional tag that can be used to influence the rendering order of Fruml tags
- any other attributes
Other attributes are passed to the plugin method as an associative array
[component name="component_name" foo="bar"]
This tag calls a component and is replaced by the output returned from the component.
Any extra attributes defined in the Fruml tag are available in the component as variables (e.g. variable foo will be defined with the value bar).
Attributes available for this tag:
- name
The name of the component to run
- transform
Used to apply text transformations to the output returned by the tag. Multiple transform attributes can be supplied and are executed in the order in which they appear in the tag
- cache
Used to define if the output of the tag is cached
- parseonpass
An optional tag that can be used to influence the rendering order of Fruml tags
- any other attributes
Other attributes are available in the component as named variables
[link name="page identifier" id="page id" site="site id"]
This tag generates a URI to another page within Fruml. The link can use an page identifier or a page id. To link to a page in another site in Fruml, you can optionally supply the site id. An example:
<a href="[link name="home"]">Home Page</a>
<a href="[link name="about" site="3"]">Home Page in another site</a>
The above code might render something similar to the following output:
<a href="/">Home Page</a>
<a href="http://localhost/about.html">A page in another site</a>
Attributes available for this tag:
- name
The identifier for the page the link should point to
- id
The id of the page the link should point to (if you supply both name and id in the tag, name has precedence)
- transform
Used to apply text transformations to the output returned by the tag. Multiple transform attributes can be supplied and are executed in the order in which they appear in the tag
- cache
Used to define if the output of the tag is cached
- parseonpass
An optional tag that can be used to influence the rendering order of Fruml tags
- tag
Whether to output a HTML tag (values are 'true' or '1')
Embeds a media item into your page. Output depends on several factors, including the content type of the media item and the combination of tag attributes.
[media name="Photo" modify="PrettyPicture"]
The above example might output something similar to the following:
<img src="/cms/cache/img/a/ad657553f5651f600fb46fa5caab58f8.jpg" alt="A photo" height="150" width="200" />
The file referenced in the src attribute of the img tag is a transformed version of the original media item called 'Photo'. In this case, the transformation 'PrettyPicture' has been applied.
Attributes available for this tag:
- name
The name of the media item to output
- transform
Used to apply text transformations to the output returned by the tag. Multiple transform attributes can be supplied and are executed in the order in which they appear in the tag
- modify
Used to apply image transformations to image media items
- cache
Used to define if the output of the tag is cached
- parseonpass
An optional tag that can be used to influence the rendering order of Fruml tags
- tag
Whether to output a HTML tag (values are 'true' or '1' to output a tag, or 'false' or '0' to output only the path to the media item). This attribute is only used for images.
- output
The file type to save images as after they've been transformed. If omitted, the original file type will be used
- bgcolor
This attribute is used when saving the modified image as a JPEG image. As JPEG images do not support transparency, a background is assigned to the image. The background colour defaults to #ffffff, but can be altered by providing the bgcolor attribute (which should be specified as hexidecimal/ html colour code). This attribute is not used when outputting PNG or GIF images
[dict name="phrase name" book="dictionary" lang="language/ locale"]
This tag outputs a dictionary entry, identified by the 'name' attribute. To specify which dictionary should be queried, the optional 'book' attribute can be supplied (if no 'book' is specified, the system will try to look for a dictionary called 'Default'). The language of the entry to retrieve can be selected using the 'lang' attribute. If no 'lang' attribute is specified, the system will search for an entry using the currently selected language (note: language/ locale selection is not yet available in the front renderer, only in the CMS itself - this will be resolved in a future release).
[dict name="aboutus"]
[dict name="aboutus" lang="nl_NL"]
The above might output something similar to:
About Us
Over ons
Attributes available for this tag:
- name
The name of the dictionary entry to output
- transform
Used to apply text transformations to the output returned by the tag. Multiple transform attributes can be supplied and are executed in the order in which they appear in the tag
- book
The name of the dictionary to query. If this attribute isn't supplied, the 'default' dictionary will be queried
- cache
Used to define if the output of the tag is cached
- parseonpass
An optional tag that can be used to influence the rendering order of Fruml tags
- lang
The language of the entry to output
[resource name="resource name"]
This tag returns the path the visitor's browser should use to request Stylesheets or JavaScript libraries managed in Fruml. For example:
<link rel="stylesheet" type="text/css" href="[resource name="styles.css"]" />
This tag would output something similar to:
<link rel="stylesheet" type="text/css" href="/cms/resource/fetch/styles.css]" />
Attributes available for this tag:
- name
The name of the resource to output
- transform
Used to apply text transformations to the output returned by the tag. Multiple transform attributes can be supplied and are executed in the order in which they appear in the tag. Note that the transformations are only applied to the path returned by the tag, not on the actual resource being requested
- cache
Used to define if the output of the tag is cached
- parseonpass
An optional tag that can be used to influence the rendering order of Fruml tags