How to add dynamic content using 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.
Link elements ¶
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 to the last page visited. Can also be used with link_open, link_url and link_title. |
| {{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>. |
| {{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>. |
| {{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>. |
| {{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>. |
User properties ¶
The following Insert Tags allow you to display any property of the currently logged in user.
| Insert Tag | Description |
|---|---|
| {{user::firstname}} | This tag will be replaced with the first name of the currently logged in user. |
| {{user::lastname}} | This tag will be replaced with the last name of the currently logged in user. |
| {{user::company}} | This tag will be replaced with the company name of the currently logged in user. |
| {{user::phone}} | This tag will be replaced with the phone number of the currently logged in user. |
| {{user::mobile}} | This tag will be replaced with the mobile number of the currently logged in user. |
| {{user::fax}} | This tag will be replaced with the fax number of the currently logged in user. |
| {{user::email}} | This tag will be replaced with the e-mail address of the currently logged in user. |
| {{user::website}} | This tag will be replaced with the web address of the currently logged in user. |
| {{user::street}} | This tag will be replaced with the street name of the currently logged in user. |
| {{user::postal}} | This tag will be replaced with the postal code of the currently logged in user. |
| {{user::city}} | This tag will be replaced with the city of the currently logged in user. |
| {{user::country}} | This tag will be replaced with the country of the currently logged in user. |
| {{user::username}} | This tag will be replaced with the username of the currently logged in user. |
Environment variables ¶
The following Insert Tags allow you to display environment variables like the page name or the request string.
| Insert Tag | Description |
|---|---|
| {{env::page_id}} | This tag will be replaced with the ID of the current page. |
| {{env::page_alias}} | This tag will be replaced with the alias of the current page. |
| {{env::page_name}} | This tag will be replaced with the name of the current page. |
| {{env::page_title}} | This tag will be replaced with the title of the current page. |
| {{env::page_language}} | This tag will be replaced with the language of the current page. |
| {{env::parent_alias}} | This tag will be replaced with the alias of the parent page. |
| {{env::parent_name}} | This tag will be replaced with the name of the parent page. |
| {{env::parent_title}} | This tag will be replaced with the title of the parent page. |
| {{env::main_alias}} | This tag will be replaced with the alias of the parent main page. |
| {{env::main_name}} | This tag will be replaced with the name of the parent main page. |
| {{env::main_title}} | This tag will be replaced with the title of the parent main page. |
| {{env::website_title}} | This tag will be replaced with the title of the website. |
| {{env::host}} | This tag will be replaced with the current host name. Added in version 2.9.0. |
| {{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::referer}} | This tag will be replaced with the URL of the last page visited. |
| {{env::ip}} | This tag will be replaced with the IP address of the current visitor. |
Include elements ¶
The following Insert Tags allow you to include various resources like articles, modules or files from the templates directoy.
| 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). |
| {{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 file from the templates directory (replace * with the file name). You can also provide arguments: {{file::file.php?arg1=val&arg2=val}} |
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. |
| {{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" xml:lang="fr">Au revoir</span>. |
| {{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}}{{iflng::de}}Ihr Name{{iflng}} |
| {{image::*}} | This tag will be replaced with the thumbnail of an image: {{image::tl_files/image.jpg?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") |
| {{label::*}} | This tag will be replaced with a translated label: {{label::CNT:au}} or {{label::tl_article:title:0}}. Note that only the first colon is a double colon. |

Add a comment