Insert tags

Insert tags are wildcards that are replaced with dynamic content when a page is printed to the screen. They e.g. allow you to show the current date, address a front end user by his name or include a file. Insert tags can be used almost anywhere in Contao, even on cached pages.

The following insert tags allow you to link to another page or article using its ID or alias.

Insert tag Description
{{link::*}} This tag will be replaced with a link to an internal page (replace * with the page ID or alias).
{{link::back}} This tag will be replaced with a link that points to the last visited page. It can also be used as {{link_open::back}}, {{link_url::back}} or {{link_title::back}} (see below).
{{link::login}} This tag will be replaced with a link to the login page of the currently logged in front end user (if any).
{{link_open::*}} Will be replaced with the opening tag of a link to an internal page: {{link_open::12}}Click here{{link_close}}.
{{link_url::*}} This tag will be replaced with the URL of an internal page: <a href="{{link_url::12}}">Click here</a>.
{{link_title::*}} This tag will be replaced with the title of an internal page: <a title="{{link_title::12}}">Click here</a>.
{{link_name::*}} This tag will be replaced with the name of an internal page (replace * with the page ID or alias).
{{link_close}} Will be replaced with the closing tag of a link to an internal page: {{link_open::12}}Click here{{link_close}}.
{{article::*}} This tag will be replaced with a link to an article (replace * with the article ID or alias).
{{article_open::*}} Will be replaced with the opening tag of a link to an article: {{article_open::12}}Click here{{link_close}}.
{{article_url::*}} This tag will be replaced with the URL of an article: <a href="{{article_url::12}}">Click here</a>.
{{article_title::*}} This tag will be replaced with the title of an article: <a title="{{article_title::12}}">Click here</a>.
{{news::*}} This tag will be replaced with a link to a news item (replace * with the news ID or alias).
{{news_open::*}} Will be replaced with the opening tag of a link to a news article: {{news_open::12}}Click here{{link_close}}.
{{news_url::*}} This tag will be replaced with the URL of a news article: <a href="{{news_url::12}}">Click here</a>.
{{news_title::*}} This tag will be replaced with the title of a news article: <a title="{{news_title::12}}">Click here</a>.
{{news_feed::*}} This tag will be replaced with the URL of a news feed (replace * with the news feed ID).
{{event::*}} This tag will be replaced with a link to an event (replace * with the event ID or alias).
{{event_open::*}} Will be replaced with the opening tag of a link to an event: {{event_open::12}}Click here{{link_close}}.
{{event_url::*}} This tag will be replaced with the URL of an event: <a href="{{event_url::12}}">Click here</a>.
{{event_title::*}} This tag will be replaced with the title of an event: <a title="{{event_title::12}}">Click here</a>.
{{calendar_feed::*}} This tag will be replaced with the URL of a calendar feed (replace * with the calendar feed ID).
{{faq::*}} This tag will be replaced with a link to a frequently asked question (replace * with the FAQ ID or alias).
{{faq_open::*}} Will be replaced with the opening tag of a link to a question: {{faq_open::12}}Click here{{link_close}}.
{{faq_url::*}} This tag will be replaced with the URL of a question: <a href="{{faq_url::12}}">Click here</a>.
{{faq_title::*}} This tag will be replaced with the title of a question: <a title="{{faq_title::12}}">Click here</a>.

Member properties

The following insert tags allow you to display any property of the currently logged in member (front end user).

Insert tag Description
{{user::*}} This tag will be replaced with the content of a field in the table `tl_member` in relation to the current member. (replace * with the name of the field).
{{user::firstname}} This tag will be replaced with the first name of the currently logged in member.
{{user::lastname}} This tag will be replaced with the last name of the currently logged in member.
{{user::company}} This tag will be replaced with the company name of the currently logged in member.
{{user::phone}} This tag will be replaced with the phone number of the currently logged in member.
{{user::mobile}} This tag will be replaced with the mobile number of the currently logged in member.
{{user::fax}} This tag will be replaced with the fax number of the currently logged in member.
{{user::email}} This tag will be replaced with the e-mail address of the currently logged in member.
{{user::website}} This tag will be replaced with the web address of the currently logged in member.
{{user::street}} This tag will be replaced with the street name of the currently logged in member.
{{user::postal}} This tag will be replaced with the postal code of the currently logged in member.
{{user::city}} This tag will be replaced with the city of the currently logged in member.
{{user::country}} This tag will be replaced with the country of the currently logged in member.
{{user::username}} This tag will be replaced with the username of the currently logged in member.

Page properties

The following insert tags allow you to display any property of the current page.

Insert tag Description
{{page::*}} This tag will be replaced with the content of a field in the table `tl_page` in relation to the current page. (replace * with the name of the field).
{{page::id}} This tag will be replaced with the ID of the current page.
{{page::alias}} This tag will be replaced with the alias of the current page.
{{page::title}} This tag will be replaced with the name of the current page.
{{page::pageTitle}} This tag will be replaced with the title of the current page.
{{page::language}} This tag will be replaced with the language of the current page.
{{page::parentAlias}} This tag will be replaced with the alias of the parent page.
{{page::parentTitle}} This tag will be replaced with the name of the parent page.
{{page::parentPageTitle}} This tag will be replaced with the title of the parent page.
{{page::mainAlias}} This tag will be replaced with the alias of the parent main page.
{{page::mainTitle}} This tag will be replaced with the name of the parent main page.
{{page::mainPageTitle}} This tag will be replaced with the title of the parent main page.
{{page::rootTitle}} This tag will be replaced with the name of the website.
{{page::rootPageTitle}} This tag will be replaced with the title of the website.

Environment variables

The following insert tags allow you to display environment variables like the page name or the request string.

Insert tag Description
{{env::host}} This tag will be replaced with the current host name.
{{env::url}} This tag will be replaced with the host name and the protocol.
{{env::path}} This tag will be replaced with the current base URL including the path to the Contao directory.
{{env::request}} This tag will be replaced with the current request string.
{{env::ip}} This tag will be replaced with the IP address of the current visitor.
{{env::referer}} This tag will be replaced with the URL of the last page visited.
{{env::files_url}} This tag will be replaced with the static URL of the files directory.
{{env::assets_url}} This tag will be replaced with the static URL of the assets directory.

Include elements

The following insert tags allow you to include various resources like articles, modules or files from the "templates" directory.

Insert tag Description
{{insert_article::*}} This tag will be replaced with the referenced article (replace * with the article ID or alias).
{{insert_content::*}} This tag will be replaced with the referenced content element (replace * with the element ID).
{{insert_module::*}} This tag will be replaced with the referenced module (replace * with the module ID).
{{insert_form::*}} This tag will be replaced with the referenced form (replace * with the form ID).
{{article_teaser::*}} This tag will be replaced with the teaser of an article (replace * with the article ID).
{{news_teaser::*}} This tag will be replaced with the teaser of a news item (replace * with the news ID).
{{event_teaser::*}} This tag will be replaced with the teaser of an event (replace * with the event ID).
{{file::*}} This tag will be replaced with the content of a .php, .tpl, .xhtml or .html5 file from the "templates" directory (replace * with the file name). You can also provide arguments: {{file::file.php?arg1=val&arg2=val}}. You can also retrieve the path of a file from the database with its UUID: {{file::6939a448-9b30-11e4-bcba-079af1e9baea}}.

Miscellaneous

The following insert tags allow you to perform miscellaneous tasks like adding the current date or including lightbox images.

Insert tag Description
{{date}} This tag will be replaced with the current date according to the global date format.
{{date::*}} This tag will be replaced with the current date according to a custom date format.
{{last_update}} This tag will be replaced with the date of the last update according to the global date format.
{{last_update::*}} This tag will be replaced with the date of the last update according to a custom date format.
{{email::*}} This tag will be replaced with a clickable and encrypted link to an e-mail address.
{{email_open::*}} This tag will be replaced with a clickable and encrypted link to an e-mail address. However, the closing </a> will not be added.
{{email_url::*}} This tag will be replaced by the encrypted e-mail address only.
{{lang::*}} This tag can be used to mark foreign words within a text: {{lang::fr}}Au revoir{{lang}}. It will be replaced with <span lang="fr">Au revoir</span> and adds the xml:lang="fr" attribute if the doctype is XHTML.
{{post::*}} This tag will be replaced by a given POST variable. It could be used to display fields from a submitted form.
{{abbr::*}} Mark abbreviations in a text: {{abbr::World Wide Web}}WWW{{abbr}}. It will be replaced with <abbr title="World Wide Web">WWW</abbr>.
{{acronym::*}} Mark acronyms in a text: {{acronym::Multipurpose Internet Mail Extensions}}MIME{{acronym}}. It will be replaced with <acronym title="Multipurpose Internet Mail Extensions">MIME</acronym>.
{{ua::*}} Output properties of the user agent: {{ua::browser}}. It will e.g. be replaced with "chrome".
{{iflng::*}} This tag will be completely removed if the page language does not match the tag language. You can use it to define language-specific labels: {{iflng::en}}Your name{{iflng::de}}Ihr Name{{iflng}}.
{{ifnlng::*}} This tag will be completely removed if the page language matches the tag language. You can use it to define language-specific labels: {{ifnlng::de}}Your name{{ifnlng}}{{iflng::de}}Ihr Name{{iflng}}.
{{image::*}} This tag will be replaced with the thumbnail of an image (replace * with the database ID, UUID or a file system path): {{image::58ca4a90-2d30-11e4-8c21-0800200c9a66?width=200&height=150}}.
width: Thumbnail width,
height: Thumbnail height,
alt: Alternative text,
class: CSS class,
rel: rel-attribute (e.g. "lightbox"),
mode: Mode ("proportional", "crop" or "box").
{{picture::*}} This tag will be replaced with an image and various image sources depending on your image size preferences and if the size parameter is a valid ID (replace * with the database ID, UUID or a file system path): {{picture::58ca4a90-2d30-11e4-8c21-0800200c9a66?size=1&template=picture_default}}.
width: Thumbnail width,
height: Thumbnail height,
alt: Alternative text,
class: CSS class,
rel: rel-attribute (e.g. "lightbox"),
mode: Mode ("proportional", "crop" or "box"),
size: An image size ID (See Themes -> Image sizes),
template: The default template (picture_default).
{{label::*}} This tag will be replaced with a translated label. The first parameter is a language file name or an acronym such as CNT (countries) or LNG (languages). Examples: {{label::CNT:au}} displays "Australia" and {{label::tl_article:title:0}} displays "Title".
Note that only the first colon is a double colon.
{{version}} This tag will be replaced with the current Contao version (e.g. 3.2.7).
{{request_token}} This tag will be replaced with the request token of the current session.
{{toggle_view}} Adds the link which allows you to switch between mobile and desktop layout.
{{br}} This tag will be replaced with the HTML <br> tag (line break).

Insert tag flags

Using flags, insert tags can be further processed. For example, the value can be passed to specific PHP methods. Multiple flags can be applied:

{{ua::browser|uncached}}
{{page::title|decodeEntities|strtoupper}}

Available flags:

Flag Description More information
uncached Do not replace insert tag when the page is cached
refresh Do not cache the insert tag, even if it is used multiple times on the same page
addslashes Quote a string with slashes PHP function
stripslashes Remove the slashes from a quoted string PHP function
standardize Standardize the output (e.g. for a page alias or CSS class)
ampersand Convert ampersands to HTML entities
specialchars Convert special characters to HTML entities
nl2br Inserts HTML line breaks before all newlines in a string PHP function
nl2br_pre Same as nl2br, but keeps line breaks in <pre> tags
strtolower Make a string lowercase PHP function
utf8_strtolower Unicode-aware lowercase conversion
strtoupper Make a string uppercase PHP function
utf8_strtoupper Unicode-aware uppercase conversion
ucfirst Make a string's first character uppercase PHP function
lcfirst Make a string's first character lowercase PHP function
ucwords Uppercase the first character of each word in a string PHP function
trim Strip whitespace from the beginning and end of a string PHP function
rtrim Strip whitespace from the end of a string PHP function
ltrim Strip whitespace from the beginning of a string PHP function
utf8_romanize Romanize the output
strrev Reverse a string PHP function
encodeEmail Encode email addresses in the output see String::encodeEmail
decodeEntities Decodes HTML entities in the output see String::decodeEntities()
number_format Formats a number (without decimal places) see System::getFormattedNumber()
currency_format Formats a currency (two decimal places) see System::getFormattedNumber()
readable_size Convert file sizes to human readable format see System::getReadableSize()
urlencode URL-encodes strings. PHP function
rawurlencode URL-encode according to RFC 3986. PHP function

results matching ""

    No results matching ""