Core Tags
As of March 2017, Branch Code is deprecated and no longer developed. Use the Twig syntax instead.
Where can tags be used?
Core tags can be used just about anywhere in the site. They can be used in Templates, Snippets, Navigation Menu Templates and in Page Content Layouts, Page Content Snippets and app content templates.
- Header Tags
- Content Tags
- Inline Javascript Tag
- Navigation Tag
- Snippet Tag
- Container Tag
- Breadcrumb Trail Tags
- Variable Tags
- AP Tags
- AP Assign Tag
- AP Request Tags
Header Tags
These tags will go in the head (<head></head>) section of the template HTML.
Tag | Description |
---|---|
{ap_template:title} | Gets the entire title tag along with the title text. Result: <title>My Title Text</title> |
{ap_template:titleText} | Gets just the title text. Use in between the <title></title> tags. Usage: <title>{ap_template:titleText}</title> Result: <title>My Title Text</title> |
{ap_template:css} | Gets any links to style sheets or inline styles set by a module. Result: <link href="/link/to/stylesheet.css" rel="stylesheet" type="text/css" /> |
{ap_template:head} | Gets any miscellaneous information to be placed in the <head></head> section of the HTML. |
{ap_template:javascript} | Gets any links to javascript files or inline javascript set by a module. Result: <script type="text/javascript" src="/path/to/javascript.js"></script> |
{ap_template:meta} | Gets any meta tags set by a content page or a module. This is typically used to pull in the description and keywords meta tags set by an app. Results: Any meta tag. |
{ap_template:doctype} | Gets the doctype. The doctype comes from the doctype set for the template. Result: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
{ap_template:doctype includeHtmlTag="true"} | Gets the doctype and the <html> tag. This is useful for the XHTML doctypes and the <html> tag requires the "xmlns" attribute. The doctype comes from the doctype set for the template. Result: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> |
{ap_template:style} | Gets any inline CSS styles set by a module. Result: <style type="text/css>STYLES HERE</style> |
Content Tags
There are a couple of variations of the content tag. The first one is a shortcut tag to just get the main content block. The next two are the exact same in functionality, just their syntax is different.
Tag | Description |
---|---|
{ap_content} | Gets the main content block. |
{ap_content:blockName} | Gets the content block specified by 'blockName'. |
Inline Javascript Tag
This tag can be used to pull in any inline javascript that should be set within the body of the page.
Tag | Description |
---|---|
{ap_template:inlineScript} | Gets any inline javascript set by a module to set within the page body. |
Navigation Tag
This tag is used to get a particular navigation menu.
Tag | Description |
---|---|
{ap_navigation:menuKey} | Gets the navigation menu specified by 'menuKey'. |
Snippet Tag
Tag | Description |
---|---|
{ap_snippet:snippetKey} | Gets the snippet specified by the 'snippetKey'. |
Container Tag
This tag is used to get the content for a specific container.
Tag | Description |
---|---|
{ap_template:container key="containerKey"} | Gets the content for the container specified by 'containerKey'. |
Breadcrumb Trail Tags
Tag | Description |
---|---|
{ap_template:breadcrumb} |
Gets the breadcrumb trail for the page.
Example: The above tag will start at the second item in the breadcrumb trail and will include 3 items. |
{ap_template:breadcrumbText} | Gets only the breadcrumb trail text for the current page. |
Variable Tags
Variables are meant to hold values set by a module that can be displayed in a page. They are designated by the following format: {#variableName} where 'variableName' is the actual name of the variable. Below are some of the core variable tags that can be used.
Tag | Description |
---|---|
{#body} | Catch-all tag for the ID, Class and Onload attributes for the <body> tag. This can be used instead of {#bodyId}, {#bodyClass} and {#bodyOnload} as all of those variable values are contained in this one tag. Usage: <body{#body}> |
{#bodyIdValue} | Gets the id text for the <body> tag. This would be used when it's known that the <body> tag will always have an id. Usage: <body id="{#bodyIdValue}"> |
{#bodyId} | Gets the id attribute for the <body> tag. This would be used when it's NOT known that the <body> tag will always have an id. Usage: <body{#bodyId}> Results: <body id="bodyID"> or <body> |
{#bodyClassValue} | Gets the class text for the <body> tag. This would be used when it's known that the <body> tag will always have at least one class. Usage: <body class="{#bodyClassValue}"> |
{#bodyClass} | Gets the class attribute for the <body> tag. This would be used when it's NOT known that the <body> tag will always have at least one class. Usage: <body{#bodyClass}> Result: <body class="className"> or <body> |
{#bodyOnloadValue} | Gets the Javascript for the onload attribute for the <body> tag. This would be used when it's known that the <body> tag will always have an onload event. Usage: Usage: <body onload="{#bodyOnloadValue}"> |
{#bodyOnload} | Gets the onload attribute for the <body> tag. This would be used when it's NOT known that the <body> tag will always have an onload event. Usage: <body{#bodyOnload}> Result: <body onload="onloadEvent();"> or <body> |
AP Tags
These are miscellaneous tags.
These tags can also be used in Content Templates for an app, Page Content Block Layouts, Form Templates, Navigation Templates, Widget Templates or just about anywhere.
Tag | Description |
---|---|
{ap:redirect location="http://www.mysite.com"} | Redirects to the given location Required Option: location: The URL to redirect to Optional Option: status: The HTTP status code. Defaults to 302. Allowed values are 301, 302, 303, or 304. |
{ap:date format="format"} | Shows the current date in the specified format. See the Date Formats page for available date formats. |
{ap:time format="format"} | Shows the current time in the specified format. See the Date Formats page for available time formats. |
{ap:year} | Gets the current full year (4 digits). |
{ap:year format="format"} | Gets the current year in the specified format. See the Date Formats page for available year formats. |
{ap:month} | Gets the current full textual month. i.e. October |
{ap:month format="format"} | Gets the current month in the specified format. See the Date Formats page for available month formats |
{ap:day} | Gets the current 2 digit day with leading zero. |
{ap:day format="format"} | Gets the current day in the specified format See the Date Formats page for available day formats |
{ap:hour} | Gets the current 2 digit hour with leading zero. |
{ap:hour format="format"} | Gets the current hour in the specified format. See the Date Formats page for available hour formats |
{ap:minute} | Gets the current 2 digit minute with leading zero. |
{ap:second} | Gets the current 2 digit second with leading zero. |
{ap:pageUpdatedOnTimestamp} |
Holds the timestamp for when the newest element on the page was updated. Any of the components on the page could affect this value. Typical items that could affect this date is navigation items, navigation templates, templates, snippets, page content, app item content, and content templates. Type: Optional Options: Example: Output the date as Month/Day/Year {ap.pageUpdatedOnTimestamp format="M/d/Y"} |
{ap:updatedOnTimestamp} |
Holds the last modified timestamp for the item that is the focus of the page. That item could be Page content, a Blog post, a Gallery item, a Store category or another app item. Type: Optional Options: Example: Output the date as Month/Day/Year {ap.pageUpdatedOnTimestamp format="M/d/Y"} |
{ap:setTitle} |
Sets the value of the <title> tag for the page. This will override any existing title value. Options: Example: {ap:setTitle value="New Page Title"} |
{ap:appendTitle} |
Appends some text to the <title> tag for the page. Options: Examples: {ap:appendTitle value=" Stuff at the end"} A real world example. The goal is that with paginated blog post pages to add the page number to the page title so that it is unique. If the page title is originally "Blog Posts" after this code the page title will be "Blog Posts - Page 2" (assuming that the visitor is on page 2). {ap:appendTitle value=" - Page "} |
{ap:prependTitle} |
Prepends some text the <title> tag for the page. Options: Example: {ap:prependTitle value="Stuff at the beginning "} |
{ap:request} |
Handles setting up and sending a GET or POST request to an external URL. |
AP Assign Tag
The ap_assign tag lets you create custom variables to use in Content Templates for an app, Page Content Block Layouts, Form Templates, Navigation Templates, Widget Templates, site Templates, Snippets or just about anywhere.
An example usage would be if you wanted to programatically set the bodyId variable.
{ap_assign bodyId=" id='new-body-id'"}
The tag can set multiple variables at one time. They just need to be setup as name => value pairs and separated by a space.
{ap_assign variable1="value1" variable2="value2" variable3="value3"}
The variables can then be used in any template, snippet, content, or whatever following the assignment tag.
For example, if you were using the following assignment tag:
{ap_assign testVar="test value"}
then you can use
{#testVar}
to include that variable.
Quotes (single or double) can be used in the variable value, but they can't the be same type of quote that surrounds the value (same rule that HTML tag attributes have).
By default the variable won't overwrite an existing variable assignment of the same name. That can be changed by putting ":overwrite" immediately after "ap_assign".
{ap_assign:overwrite bodyId=" id='new-body-id'"}
This will make it so that if "bodyId" has already be setup and assigned it will be overwritten with the new value.
AP Request Tags
The AP Request tags allow you to submit a POST or GET* request to a URL.
A sample scenario is if you need to submit form information to a 3rd party as well as save it within the CMS. In that case you can setup a Custom Process Script for the form to build the data to send and submit it to a URL as a POST submission.
* Right now no data is returned from the request so the GET request isn't very useful
Example
Below is a small example to post some XML to a URL
{#xml|set value="<?xml version='1.0' encoding='utf-8' ?>"}
{#xml|append value="<Data>"}
{#xml|append value="<Name>Bob Test</Name>"}
{#xml|append value="</Data>"}
{ap:request:new url="http://posttestserver.com/post.php"}
{ap:request:setBody body="{#xml}" encoding="text/xml"}
{ap:request:post}
Tags
Below are the available request tags.
Tag | Description | ||||
---|---|---|---|---|---|
{ap:request:new url="URL"} |
Creates a new request object. Optional Optionurl: The full URL to submit the request to. If this is not set here then it needs to be set within {ap:request:setUrl} Example{ap:request:new url="http://posttestserver.com/post.php"} |
||||
{ap:request:setUrl url="URL"} |
Sets the URL for the request object Required Optionurl: The full URL to submit the request to. If this is not set here then it needs to be set within {ap:request:setUrl} Example{ap:request:setUrl url="http://posttestserver.com/post.php"} |
||||
{ap:request:setHeader name="NAME" value="VALUE"} |
Sets the header for the request Required Options
Example{ap:request:setHeader name="Content-type" value="text/html; charset=utf-8"} |
||||
{ap:request:setAuthentication username="X" password="Y"} |
Sets the basic authentication credentials for the request. Required Options
Example{ap:request:setAuthentication username="aptuitiv" password="abc123"} |
||||
{ap:request:setBody body="BODY" encoding="TYPE"} |
Sets the body for the request. Required option
Optional option
Example{ap:request:setBody body="{#xml}" encoding="text/xml"} |
||||
{ap:request:setGetParameter name="NAME" value="VALUE"} |
Sets a single GET parameter. Required options
Example{ap:request:setGetParameter name="paramName" value="paramValue"} |
||||
{ap:request:setPostParameter name="NAME" value="VALUE"} |
Sets a single POST parameter. Required options
Example{ap:request:setPostParameter name="paramName" value="paramValue"} |
||||
{ap:request:send method="post"} |
Sends the request using the specified method. Required option
Optional option
ExampleSend a POST request {ap:request:send method="post"} Send a GET request {ap:request:send method="get"} Send a POST request and save the response to a variable called "response". Assuming that the response is a JSON response convert the response body to an array that can be worked with. {ap:request:send method="post" saveAs="response"} |
||||
{ap:request:post} |
Sends the request as a POST request. This is shorthand for {ap:request:send method="post"} Optional option
Example{ap:request:post} Send a POST request and save the response to a variable called "response". Assuming that the response is a JSON response convert the response body to an array that can be worked with. {ap:request:post saveAs="response"} |
||||
{ap:request:get} |
Sends the request as a GET request. This is shorthand for {ap:request:send method="get"} Optional option
Example{ap:request:get} Send a GET request and save the response to a variable called "response". Assuming that the response is a JSON response convert the response body to an array that can be worked with. {ap:request:get saveAs="response"} |
||||
{ap:request:getRequestData} |
Gets the request headers and request body information. This is intended to be used for debugging a request if you are having troubles. It's intended that this is called after a request is made. Required option
Example{ap:request:getRequestData saveAs="requestData"} |
||||
{ap:request:getRequestBody} |
Gets the request body that was submitted. This is intended to be used for debugging a request if you are having troubles. It's intended that this is called after a request is made. Required option
Example{ap:request:getRequestBody saveAs="requestBody"} |
||||
{ap:request:getRequestHeaders} |
Gets the headers that were submitted with the request. This is intended to be used for debugging a request if you are having troubles. It's intended that this is called after a request is made. Required option
Example{ap:request:getRequestHeaders saveAs="requestHeaders"} |