Base Tag Library
Note: We have updated our folder structure in Neto 6 and this has not been updated on all tweaks yet. More info.

set

Lets you set and read your own variables using b@se tags

Example

Setting the tag

[%set [@unixdate@] %]
    [%format type:'date' format:'#U'%][@date_created@][%/format%]
[%/set%]

Using the tag

[@unixdate@]

Usage

The set tag allows you to generate your own tags using b@se. Once set, this tag allows you to treat it just as any other tag in neto, you can use it in paramaters, inside any other tag on the page, perform logic on it, etc.

In the example above, we use a format tag to turn an existing tag, [@date_created@] into a unix time code. Then we store the new timecode as it's own new tag, [@unixdate@] which we can then use on the page.

The 'session' function

Note : Session tags do not work with varnish enabled on your site.

Using the special value tag session, you can use set tag to store data to a variable that is then accessible site wide.

To do this, we use the session short hand like so

[%set [@session:globalExample@]%]
    Example data
[%/set%]

Then you can load this new session value tag on any other page or template and it will return your value, so setting the above on the home page, then loading the following on the about us page

[@session:globalExample@]

Will print

Example data

5 related articles found: