Layout functions
From Snowfire Wiki
Layout functions is methods you can use withing a page layout.
Contents |
Has Tag
Example usage
<div class=" { fnc_hasTag ( tags:'foo,bar', after:'-style' ) } "> </div>
Adds a class named foo-style or bar-style if the current page is tagged with those tags.
Full featured example
{ fnc_hasTag ( tags:'foo, bar', after:'[after]', before:'[before]', separator:'[separator]' ) }
Generates the following, if both tags foo and bar are set.
[before]foo[after][separator][before]bar[after]
returnOnTrue/False example
{ fnc_hasTag ( tags:'foo', returnOnTrue:'exists' ) }
Generates the following, if tag foo is set.
exists
{ fnc_hasTag ( tags:'foo', returnOnFalse:'missing' ) }
Generates the following, if tag foo is not set.
missing
Wildcards
It is possible to write dynamic tag selectors, using wildcards. To match the tags color-blue and color-red you can either write tags:'color-blue, color-red', or with wildcards tags:'color-*'.
Resource
Example usage
Code
{ fnc_resource ( file:'logotype.png', alt:'Logotype' ) }
Output
<img src="/accounts/1234/images/logotype.png?t=2010-10-05-21-36-04" alt="Logotype" />Parameters
-
file- The image file to load. The path should be relative to/imagesdirectory in the account FTP. -
alt- Set thealtattribute of the image.
Publish date
Example usage
Code
{ fnc_publishDate ( format:'%Y-%m-%d' ) }
Output
2010-10-18
Parameters
-
format- Date format.
