Change Log
- Added external resource link for BC to Treepl App conversion info.
BC Liquid Comparisons
Below are some typical Business Catalyst (BC) legacy Liquid and tags and their closest Treepl CMS comparisons that you may have found left over in old code.
Item Data |
---|
BC: Page Name{module_pagename} eg: "About" Treepl CMS: {{this.name}} Name of current item (within the context/scope of the template/layout where it is placed) |
BC: Page Title{module_pagetitle} eg: "About ABC Company" Treepl CMS: {{this.seotitle}} Meta title of current item (within the context/scope of the template/layout where it is placed) |
BC: Page ID{module_oid} eg: "12345" Treepl CMS: {{this.id}} ID of current item (within the context/scope of the template/layout where it is placed) |
This Liquid object is globally accessible in every liquid template or layout and outputs specific data relating to the item being render.
{{ this }}
For example, if {{this}}
is placed in a Page content area it will render the liquid data of that page. Likewise if placed in a Module content field, it will render the liquid data available for the specific module item being viewed.
Liquid Output
Below is a live example of the {{this}}
output for this very documentation article.
{
"Id": 2324,
"Name": "{{ this }} object",
"Url": "/liquid/this-object",
"Url_List": [
"/liquid/this-object"
],
"UrlSlug": "this-object",
"ParentId": 1881,
"ParentId_List": [
1881
],
"ParentName": "Liquid Objects & Usage",
"ParentUrl": "/liquid",
"TemplateName": "Docs Template",
"Module_Alias": "DocumentationPost",
"Module_ID": 1870,
"Enabled": true,
"ReleaseDate": "2018-08-03T23:00:00",
"ExpiryDate": "2099-11-29T00:00:00",
"SiteSearchKeywords": [],
"Description": "<p>This Liquid object is globally accessible in every liquid template or layout and outputs specific data relating to the item being render.</p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n<p>For example, if <code>{{this}}</code> is placed in a Page content area it will render the liquid data of that page. Likewise if placed in a Module content field, it will render the liquid data available for the specific module item being viewed.</p>\r\n\r\n{% component type: \"snippet\", alias: \"section_output\" %}\r\n<p>Below is a live example of the <code>{{this}}</code> output for this very documentation article.</p>\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{this}}\", lang: \"json\" %}\r\n</section>\r\n\r\n\r\n{% component type: \"snippet\", alias: \"section_accessing_data\" %}\r\n<p>As an example of rendering a desired value to the page you could use the following Liquid:</p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n<p>This would output the value <code>/liquid/this-object</code> to the page based on the above data.</p>\r\n\r\n{% component type: \"snippet\", alias: \"section_viewing_data_while_developing\", object: \"this\", filter: \" | strip_html\" %}\r\n</section>\r\n\r\n\r\n",
"Weighting": 985,
"DisableForSiteSearch": false,
"CreatedByMemberId": "0",
"ItemCategories": [
"Sample Category"
],
"ItemCategoryIdList": [
1346
],
"ItemTags": [
"Liquid Usage"
],
"Author": 0,
"Author_Name": "",
"Author_Url": "",
"Item_Rating": 0,
"Active": true,
"IgnoreUpdates": true,
"UpdatesLog": "",
"ExternalResources": "",
"AdditionalRelatedArticle": 0,
"AdditionalRelatedArticle2": 0,
"Authors": "2418",
"ShowPageForSearchEngine": true,
"MetaTitle": "",
"SEOTitle": "",
"MetaDescription": "",
"CanonicalLink": "",
"SocialMetaTags": "",
"SeoPriority": 0.0,
"EnableAMP": false,
"AMPContent": "",
"OpenGraphProperties": {
"title": "",
"type": "",
"url": "",
"locale": "",
"image": ""
},
"ExternalId": 0,
"Params": {
"source": "Documentation Post",
"layout": "Body Detail",
"filterby": "id",
"filtervalue": "2324",
"limit": "1",
"type": "snippet",
"alias": "section_output",
"data": "this",
"lang": "liquid",
"name": "SECTION Output",
"content": "<section id=\"secOutput\">\n <h2>Liquid Output</h2>",
"enabled": true
}
}
Accessing the Data
JSON Output
You can output the full JSON for your component data by referencing the root Liquid object {{this}}
in your module’s layouts, or directly on your page, if using the collectionVariable
parameter in your component tag.
For example:
{% component type: ... collectionVariable: "myData" %}
You can then render the JSON like so:
{{myData}}
For more details on using this approach, see Part 2 of the free ‘Learning Liquid Course’.
Rendering Property Values
As an example of rendering a desired value to the page you could use the following Liquid:
{{ this.url }}
This would output the value /liquid/this-object
to the page based on the above data.
Viewing Data while Developing
It is often desirable to see all the data that is available to you on a page while developing your applications and there are two common techniques for doing this.
1. Rendering JSON to the Page
You can quickly and easily render the full JSON output directly to the page you are working on in order to view all the data and its structure in an easy to read format.
Simply wrap your desired Liquid object in <pre>
tags like so; <pre>{{this}}</pre>
A JSON representation of the available data will be rendered to the page similar to the output examples above.
This of course is a temporary technique as you would not want to leave the JSON data visible on the page.
2. Rendering JSON to the Console
Perhaps a cleaner and more persistent way of viewing this data while in development, is to log the JSON output to your browser's console (in the browser's Developer Tools).
To do this, add some javascript code to your template file (just before the closing </body>
tag) like this:
<script>
console.log({{this | strip_html}});
</script>
What this will do is output the JSON data into a structured data tree in your browser's Developer Tools console.
You can actually use this method to log any Liquid data to the console, such as a custom collection, for example:
<script>
console.log({{myCustomCollection | strip_html}});
</script>
You might notice the Liquid filter | strip_html
added here. This is optional, however, in some cases the JSON data will contain HTML code and this can break the Javascript, causing a scripting error.
So, keep in mind that, when using this filter, any fields containing HTML code in your JSON will not actually show the HTML in the console, however, the data is still there and accessible via Liquid when rendering to the page.
Remember to remove this code for production as it could pose a data security risk and it is best practice not to leave console logs in your scripts.
System Data |
---|
BC: Page URL and URL Parameters{module_url param="param1"} and {module_pageaddress} eg: { "ID": "/test2.html", "question": "true", } Treepl CMS: {{request.request_url}} Output: { "href": "https://docs.treepl.co/test2?question=true", "origin": "https://docs.treepl.co", "protocol": "https", "hostname": "docs.treepl.co", "path": "/test2", "params": { "question": "true" } } |
BC: Referral Address{module_referreraddress} eg: "http://mysite.com/page1" Treepl CMS: {{request.request_data.referrer}} |
BC: Globals and Visitor IP Address{module_visitoripaddress} and {{globals.visitor}} eg: "193.2.2.2" { "deviceClass": "desktop", "ip": "193.2.2.2", "country": "RO", "userAgent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36" } Treepl CMS: {{request.request_data}} Output: { "ip": "193.2.2.2", "is_mobile": 0, "user_agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36", "referrer": "/page1" } |
BC: Visitor Device Class{system_visitordeviceclass} eg: "desktop", "phone" or "tablet" Treepl CMS: {{request.device_type}} Output: "Desktop", "Tablet", "Mobile" |
BC: Logged In User{{globals.user}} and {module_isloggedin} eg: "1" or "0" { "firstname": "Alex", "lastname": "Smith", "fullname": "Alex Smith", "email": "asmith@example.com", "isLoggedIn": true } Treepl CMS: {{request.is_logged}} and {{request.currentmember}} Output: "true" or "false" { "id": 162, "email": "asmith@example.com", "firstname": "Alex", "lastname": "Smith", "address": null, "city": null, "state": null, "zipcode": null, "country": "Australia", "site": null, "phone": null, "createddatetime": "2018-11-21T15:17:22.717", "updateddatetime": "2018-11-21T15:17:22.763", "securezones": [ { "id": 2, "name": "Members Secure Zone", "landingpageid": 2541, "createddatetime": "2018-11-21T15:17:23.037", "updateddatetime": "2018-11-21T15:17:23.037" } ] } |
This Liquid object is globally accessible in every liquid template or layout and outputs various data relating to your site.
{{ request }}
Liquid Output
An live render of the data output is below.
{
"cookies": {},
"request_url": {
"href": "https://docs.treepl.co/liquid/bc-liquid-comparisons",
"origin": "https://docs.treepl.co",
"protocol": "https",
"hostname": "docs.treepl.co",
"path": "/liquid/bc-liquid-comparisons",
"params": {},
"originalParams": {}
},
"request_data": {
"ip": "3.133.156.128",
"is_mobile": 0,
"user_agent": "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)",
"referrer": ""
},
"currentmember": "",
"is_logged": false,
"device_type": "Desktop",
"timezone": {
"label": "(UTC-06:00) Central Time (Chicago)",
"offset": -6.0
},
"system_recaptcha_sitekey": "6Lf2cGcUAAAAABbL4aDrclASNZx9S3uaI9EvpvlI"
}
currentmember
When a user is logged in to a secure zone, the request.currentmember
property (part of the request
object) will return the logged in member's data. An example is below:
{
"is_logged": true,
"currentmember": {
"id": 162,
"email": "asmith@example.com",
"firstname": "Alex",
"lastname": "Smith",
"address": null,
"city": null,
"state": null,
"zipcode": null,
"country": "Australia",
"site": null,
"phone": null,
"status": "",
"notes": "",
"type": 2,
"stripecustomerportallink": "https://YOUR-SITE.treepl.co/public/api/stripe/create-customer-portal-session",
"isDataUsingAllowed": true,
"createddatetime": "9/11/2019 3:32:23 AM",
"updateddatetime": "3/24/2021 2:44:32 AM",
"securezones": [
{
"id": 2,
"name": "Members Secure Zone",
"landingpageid": 2541,
"createddatetime": "2018-11-21T15:17:23.037",
"updateddatetime": "2018-11-21T15:17:23.037",
"expirydatetime": "9999-12-30T13:00:00"
}
]
}
}
To access data within the securezones
array you can use a forloop
to loop through each secure zone item.
So we might render a list of available secure zones and their expiry dates, like so:
<ul>
{% for zone in request.currentmember.securezones %}
<li>{{zone.name}} (Expiry: {{zone.expirydatetime | date}})</li>
{% endfor %}
</ul>
Rendering the following details:
- Members Secure Zone (Expiry: 30-Dec-9999)
device_type
The possible values provided by the device_type
property are:
Desktop
: when a desktop browser is rendering the page.Tablet
: when a tablet browser is rendering the page.Mobile
: when a mobile/smart phone browser is rendering the page.
A typical use case for this property is to display different content depending on the users device.
The following Liquid example will render different results on the three different device types:
{% case request.device_type %}
{% when 'Mobile' %}
<p>I'm mobile</p>
{% when 'Tablet' %}
<p>I'm an iPad or similar tablet.</p>
{% else %}
<p>I must be a desktop.</p>
{% endcase %}
When using the output values in Liquid logic they are case sensitive. So, {% if request.device_type == "desktop" %}...
will not work, whereas {% if request.device_type == "Desktop" %}...
will work.
params
‘Params’ refers to any URL Parameters being passed in the current page URL. These are also sometimes called ‘Query Strings’.
URL Parameters can be used to pass addition or variable information to a page. This information might be specific to the user or carry some data from the previous page the user has come from.
A common use case is for analytical tracking and/or personalisation of the page based on a marketing campaign link, say, from an email campaign.
So the user might receive an email campaign with a link to your landing page and the link has been constructed to contain the user's name and campaign ID - so you can use their name to personalise your website landing page and use the ID in your analytics tracking script.
Using Liquid we can extract those URL parameters and render them into your page at time of page load.
Constructed link example:
<a href="https://www.yoursite.com/landing-page?fname=Joe&lname=Smith&campid=12345">Visit Landing Page</a>
Take particular notice of the URL Parameter structure added to the landing page path:
?fname=Joe&lname=Smith&campid=12345
The request
object will contain each of the URL Parameter’s key/value pairs.
So using the following Liquid tag will give us access to all the URL Parameters:
{{request.request_url.params}}
{
"fname": "Joe",
"lname": "Smith",
"campid": "12345"
}
Therefore, you could render the user’s first name into the page heading, for example:
<h1>Welcome {{request.request_url.params.fname}}</h1>
<h1>Welcome Joe</h1>
For more information on URL Parameters/Query Strings check the External Resources section below for relevant links.
Accessing the Data
JSON Output
You can output the full JSON for your component data by referencing the root Liquid object {{this}}
in your module’s layouts, or directly on your page, if using the collectionVariable
parameter in your component tag.
For example:
{% component type: ... collectionVariable: "myData" %}
You can then render the JSON like so:
{{myData}}
For more details on using this approach, see Part 2 of the free ‘Learning Liquid Course’.
Rendering Property Values
As an example of rendering a desired value to the page you could use the following Liquid:
{{ request.request_data.is_mobile }}
This would output the value 0
to the page based on the above example data.
By the way, the is_mobile
property is a boolean indicating whether the device being used is a mobile device or not. Where 0
indicated it is not a mobile device and 1
indicated it is a mobile device.
Extending on this example, we can use this value in a conditional Liquid statement to display different content on a page for mobile devices like so:
{% if request.request_data.is_mobile == 1 %}
<p>You're viewing mobile enabled content!</p>
{% else %}
<p>You're viewing desktop content!</p>
{% endif %}
Viewing Data while Developing
It is often desirable to see all the data that is available to you on a page while developing your applications and there are two common techniques for doing this.
1. Rendering JSON to the Page
You can quickly and easily render the full JSON output directly to the page you are working on in order to view all the data and its structure in an easy to read format.
Simply wrap your desired Liquid object in <pre>
tags like so; <pre>{{request}}</pre>
A JSON representation of the available data will be rendered to the page similar to the output examples above.
This of course is a temporary technique as you would not want to leave the JSON data visible on the page.
2. Rendering JSON to the Console
Perhaps a cleaner and more persistent way of viewing this data while in development, is to log the JSON output to your browser's console (in the browser's Developer Tools).
To do this, add some javascript code to your template file (just before the closing </body>
tag) like this:
<script>
console.log({{request}});
</script>
What this will do is output the JSON data into a structured data tree in your browser's Developer Tools console.
You can actually use this method to log any Liquid data to the console, such as a custom collection, for example:
<script>
console.log({{myCustomCollection | strip_html}});
</script>
You might notice the Liquid filter | strip_html
added here. This is optional, however, in some cases the JSON data will contain HTML code and this can break the Javascript, causing a scripting error.
So, keep in mind that, when using this filter, any fields containing HTML code in your JSON will not actually show the HTML in the console, however, the data is still there and accessible via Liquid when rendering to the page.
Remember to remove this code for production as it could pose a data security risk and it is best practice not to leave console logs in your scripts.
Content Modules |
---|
BC: WebApp listing module{module_webapps render="item|collection" id="webappId|webappName" filter="item" itemId="123" targetFrame="" resultsPerPage="" hideEmptyMessage="false" rowCount="" sortType="ALPHABETICAL" collection="my_custom_collection_name" template="/folder/template.tpl"} eg:
Treepl CMS:
Notes: No "targetFrame" or "rowCount" equivalents as no longer necessary. Fully documented Component parameters below. |
BC: Blog's Post listing module{module_blogpostlist render="item|collection" collection="my_custom_collection_name" template="/folder/template.tpl" blogId="12345" rowCount="10" tag="tag"} eg:
Treepl CMS:
Notes: No "rowCount" equivalent as no longer necessary. Tag filtering can by done via teh "filterBy" parameter or via Liquid conditions in the layout or collection. Fully documented Component parameters below. |
BC: Form module{module_webform id="1234""} eg:
Treepl CMS:
Fully documented Component parameters below. |
{% component type: "module", source: "<Custom Module name/ID>", layout: "List 1" %}
Parameters and Options
module (default)
module_of_member
This is the name of the entity that needs to be used for the component retrieving function.
module
is the standard retrieving function to retrieve all items.
module_of_member
retrieves only those items 'Added by' the currently logged in user (identified by the CreatedByMemberId
property in the module items Liquid data).
The 'Added by' System Property will only be available where the modules settings have 'Allow Add New Items' turned on under the 'Site User Permissions'.
<Module name/ID>
<Your Layout name>
The layout name you want to use for rendering the component. The layout name is referenced from the available Layouts of the source specified.
While this parameter is required to render your Layout markup, if the parameter is blank, has an incorrectly referenced Layout, or is removed altogether then the component will still output the modules item data to a Liquid collection which can be accessed via the collectionVariable
parameter.
id
parentid
name
weighting
url
urlslug
releasedate
expirydate
LastUpdatedDate
Author
ItemCategories
ItemTags
<CustomPropertyName>
...and any other top level properties available for the module
Remove spaces from custom property names here.
<your value>
Liquid variables can be used here also. If present but no value set, no items will be returned.
id
parentid
name
weighting
url
urlslug
releasedate
expirydate
LastUpdatedDate
Author
ItemCategories
ItemTags
<CustomPropertyName>
...and any other top level properties available for the module
Remove spaces from custom property names here.
ASC (default)
DESC
ASC
sorts the items in ascending order while DESC
sorts in descending order (based on alpha/numeric or date sorting).If empty or not present, alpha/numeric sorting will be used.
false (default)
true
false
items will sort by their weighting values first, followed by any sortBy properties (or the default alpha/numeric sorting if sortBy is empty or not present). If true
item weightings will be ignored and sorting will only be applied via sortBy or default sorting.false (default)
true
If used in conjunction with sortBy, that sorting criteria will be applied to the randomly retrieved results. So, if retrieving all, or most, of the items they will not appear to be random since they will then be sorted back into a logical order. To overcome this, set the sortBy parameter to 'enabled' (or another unused property) as this will not provide any viable sorting criteria* and the items will not be sorted from their initial random order.
* Unless there are weighted items, which will always override the random option.
10 (default)
<integer>
true (default)
false
This is useful for avoiding pagniation affects for a specific component when multiple components of the same module are output on the same page and do use pagination.
false (default)
true
<Your custom message>
Liquid variables are supported here, although Liquid logic tags and HTML are not.
If using Liquid variables with filters added, be sure to change any double quotes to single quotes. For eg: emptyMessage: “{{ myVariable | prepend: 'Error: ' }}”
To use HTML in your empty message, first capture it using a Liquid capture, then insert the capture variable into the emptyMessage parameter.
item (default)
collection
item
returns each item iteratively, one after another, for output (generally, output to a container element with no need for looping through the data).collection
returns all items as one collection for output (your container element and looping logic would be handled in the Components Layout).<yourLiquidVariableName>
Your collectionVariable value must only contain English letters, numbers or underscores. Spaces or special characters are not supported.
false (default)
true
Allows search parameters in the URL to override the components output. Therefore, this parameter can be used to output module specific search results from a submitted search form.
Likewise, Tag, Category, and Archive components can be used in conjunction with this parameter for filtering the module's output.
URL search parameters will override any corresponding parameters in the component. If no search parameters are present in the URL, isSearchResult will be ignored.
Any value
other than true
, (including an empty value), will disable the search functionality and the component will output its regular data.
{'prop_ParentId':'1234', 'prop_ReleaseDate_Min':'2018-07-01', 'prop_ReleaseDate_Max':'2018-07-31', 'prop_KeyWords':'Your Keywords', 'prop_ItemTags':['tag1','tag2'], 'page':'2'}
Allows a search on the module without search parameters needed in the URL. Instead, search parameters are added to the value
of this parameter. Therefore, this parameter can be used to output module specific search results from hard-coded (or Liquid) values without the use of a search form.
Added search parameters will override any corresponding parameters otherwise configured on the component. If no search parameters are present, searchScope will be ignored.
This value
supports Liquid and can therefore be constructed with Liquid data/variables.
<your custom value>
Your <customParameter> name must only contain English letters, numbers or underscores. Spaces or special characters are not supported.
You can use HTML as the value here, just be sure to change any double quotes in your HTML to single quotes.
Also, see here for a tutorial on using Custom Paramters.
Liquid Output
The below example has 4 sample items
but is otherwise the default data you will get from this Component.
For Custom Modules this data will also include any custom properties/fields that you've added.
{
"Params": {
"source": "DEMO Web Technologies",
"layout": "",
"collectionvariable": "webTech",
"type": "module"
},
"Pagination": {
"CurrentPage": 1,
"ItemsPerPage": 10,
"NumberOfPages": 1,
"TotalItemsCount": 4
},
"Parent": {
"Id": 1960,
"Name": "module (Custom Modules)",
"Url": "/component-types/module-custom-modules",
"Url_List": [
"/component-types/module-custom-modules"
],
"UrlSlug": "module-custom-modules",
"ParentId": 2127,
"ParentId_List": [
2127
],
"ParentName": "Liquid Components",
"ParentUrl": "/component-types",
"TemplateName": "Docs Template",
"Module_Alias": "DocumentationPost",
"Module_ID": 1870,
"Enabled": true,
"ReleaseDate": "2018-06-18T23:00:00",
"ExpiryDate": "2099-10-09T23:00:00",
"SiteSearchKeywords": [],
"Description": "\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n\r\n{% component type: \"snippet\", alias: \"section_parameters\" %}\r\n\r\n{% component type: \"json\", source_type:\"string\", source:\"{{tabularData}}\", layout:\"/snippets/tabularJSON.layout\" %}\r\n</section>\r\n\r\n{% component type: \"snippet\", alias: \"section_output\" %}\r\n\r\n<p>The below example has 4 sample <code>items</code> but is otherwise the default data you will get from this Component.</p>\r\n\r\n<p>For Custom Modules this data will also include any custom properties/fields that you've added.</p>\r\n\r\n{% component source: \"DEMO Web Technologies\", layout: "", collectionVariable: \"webTech\", type: \"module\" %}\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{webTech}}\", lang: \"json\" %}\r\n</section>\r\n\r\n{% component type: \"snippet\", alias: \"section_accessing_data\" %}\r\n\r\n<p>This data is accessible in two main ways:</p>\r\n\r\n<p>1. Using Liquid in the specified Layout via the <code>this</code> object.</p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n<p>2. Directly on the Page or Template via a Liquid Collection if <code>collectionVariable</code> was added to the Component tag.</p>\r\n\r\n<p>An example using <code>collectionVariable</code> with value \"webTech\" for a Custom Module called \"Web Technologies\":</p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n<p><em>Looping through the collection to render all the item URLs in a list, giving us:</em></p>\r\n\r\n<ul>\r\n \r\n <li>/demo-web-technologies/css</li>\r\n \r\n <li>/demo-web-technologies/html</li>\r\n \r\n <li>/demo-web-technologies/javascript</li>\r\n \r\n <li>/demo-web-technologies/liquid</li>\r\n \r\n</ul>\r\n<br>\r\n<p><em>The code:</em></p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n<p><em>Accessing a specific item within the collection. In this case the third item (zero based index), which in our example would render the value <code>/web-technologies/javascript/</code></em></p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n</section>\r\n</section>\r\n\r\n{% component type: \"snippet\", alias: \"section_counter\" %}\r\n</section>\r\n",
"Weighting": 930,
"DisableForSiteSearch": false,
"CreatedByMemberId": "0",
"ItemCategories": [],
"ItemCategoryIdList": [],
"ItemTags": [
"Custom Modules"
],
"Author": 0,
"Author_Name": "",
"Author_Url": "",
"Item_Rating": 0,
"Active": true,
"IgnoreUpdates": true,
"UpdatesLog": "<ul><li>27-Oct-2020 | 5.6.0 | Added 'ignoreWeighting' parameter</li><li>'module_of_member' parameter details added.</li></ul>",
"ExternalResources": null,
"AdditionalRelatedArticle": 0,
"AdditionalRelatedArticle2": 0,
"Authors": "2418",
"ShowPageForSearchEngine": true,
"MetaTitle": "Component Type: Module (Custom Modules)",
"SEOTitle": "Component Type: Module (Custom Modules)",
"MetaDescription": "This module component fetches data relating to Custom Modules.",
"CanonicalLink": "",
"SocialMetaTags": "",
"SeoPriority": 0.8,
"EnableAMP": false,
"AMPContent": "",
"OpenGraphProperties": {
"title": "",
"type": "",
"url": "",
"locale": "",
"image": ""
},
"ExternalId": 0,
"Params": {
"source": "Documentation Post",
"layout": "Body Detail",
"filterby": "id",
"filtervalue": "1960",
"limit": "1",
"type": "snippet",
"alias": "section_output",
"data": "\r\n{% component type: \"module\", source: \"<Custom Module name/ID>\", layout: \"List 1\" %}\r\n",
"lang": "liquid",
"name": "SECTION Output",
"content": "<section id=\"secOutput\">\n <h2>Liquid Output</h2>",
"enabled": true,
"required": "true",
"values": "module <em>(default)</em>,module_of_member"
}
},
"Items": [
{
"Id": 2262,
"Name": "CSS",
"Url": "/demo-web-technologies/css",
"Url_List": [
"/demo-web-technologies/css"
],
"UrlSlug": "css",
"ParentId": 2253,
"ParentId_List": [
-1
],
"ParentName": "",
"ParentUrl": "",
"TemplateName": "DEMO Companion Site",
"Module_Alias": "DEMOWebTechnologies",
"Module_ID": 2253,
"Enabled": true,
"ReleaseDate": "2018-11-24T16:54:00",
"ExpiryDate": "2099-12-10T16:54:00",
"SiteSearchKeywords": [],
"Description": "<p>CSS (Cascading Style Sheets) is used to describe presentation semantics i.e. how a document looks and feels.</p><p>It can be embedded directly inside tags (by using the <em>style</em> attribute) or inserted in the document head by using the <em>style</em> tag.</p><ul><div dir=\"ltr\"><br></div></ul>",
"Weighting": 0,
"DisableForSiteSearch": false,
"CreatedByMemberId": "0",
"ItemCategories": [],
"ItemCategoryIdList": [],
"ItemTags": [],
"Author": 0,
"Author_Name": "",
"Author_Url": "",
"Item_Rating": 0,
"MyCustomProperty1": "foobar",
"MyCustomProperty2": null,
"CustomDatasourceProperty": 2267,
"CustomDatasourceProperty_Name": "Null type",
"CustomDatasourceProperty_Url": "/demo-web-technologies/javascript/null-type",
"ShowPageForSearchEngine": true,
"MetaTitle": "",
"SEOTitle": "",
"MetaDescription": "",
"CanonicalLink": "",
"SocialMetaTags": "",
"SeoPriority": 0.0,
"EnableAMP": false,
"AMPContent": "",
"OpenGraphProperties": {
"title": null,
"type": null,
"url": null,
"locale": null,
"image": null
},
"ExternalId": 0,
"Params": {}
},
{
"Id": 2263,
"Name": "HTML",
"Url": "/demo-web-technologies/html",
"Url_List": [
"/demo-web-technologies/html"
],
"UrlSlug": "html",
"ParentId": 2253,
"ParentId_List": [
-1
],
"ParentName": "",
"ParentUrl": "",
"TemplateName": "",
"Module_Alias": "DEMOWebTechnologies",
"Module_ID": 2253,
"Enabled": true,
"ReleaseDate": "2018-11-24T18:00:00",
"ExpiryDate": "2099-12-10T18:00:00",
"SiteSearchKeywords": [],
"Description": "<p>The <strong>Hyper Text Markup Language</strong> (HTML) is mainly used for writing web pages. It is XML based and allows users to create structured text documents (by using tags and attributes) and insert text semantics (paragraphs, headers, tables, etc.).</p>\r\n\r\n<p>Usually it is used in conjuncture with <strong>JavaScript</strong> - which influences the behaviour of browsers - and <strong>CSS (Cascading Style Sheets)</strong> - for formating text and overall page appearance.</p>\r\n\r\n<p>Latest standard release by W3C was that of HTML 5.0 (ISO/IEC 15445:2000) in October 2014.</p>\r\n\r\n<p>In 2008 a draft for an HTML 5 was released. It includes several modifications:</p>\r\n\r\n<ul>\r\n<li>obsolete tags such as <em>font</em>, <em>frameset</em> or <em>center</em> were removed</li>\r\n<li>new tags such as <em>footer</em>, <em>audio</em>, <em>video</em>, <em>nav</em>, etc.</li>\r\n<li>new attributes such as <em>ping</em>, <em>async</em>, etc.</li>\r\n<li>new parsing mechanism</li>\r\n<li>ability to use SVG and MathML in text/html</li>\r\n<li>etc.</li>\r\n</ul>\r\n\r\n<p>Related languages include the <strong>XHTML</strong> 1.1 which is an extension of HTML based on XML and not SGML.</p>\r\n\r\n<p>Three sub-specifications exist for both HTML and XHTML:</p>\r\n\r\n<ul>\r\n<li><strong>Strict</strong>: represents the standard proper and encourages the omission of presentational markup (eg. center or font tags) by using style sheets (CSS)</li>\r\n<li><strong>Transitional</strong>: allows for presentational markup</li>\r\n<li><strong>Frameset</strong>: allows for presentational markup and additionally from <em>Transitional</em> a frameset replacing body, containing frame elements, and optionally noframes, with a body</li>\r\n</ul>\r\n\r\n<p>Each document is checked against a DTD (Document Type Definition) file for validity.</p>",
"Weighting": 0,
"DisableForSiteSearch": false,
"CreatedByMemberId": "0",
"ItemCategories": [],
"ItemCategoryIdList": [],
"ItemTags": [],
"Author": 0,
"Author_Name": "",
"Author_Url": "",
"Item_Rating": 0,
"MyCustomProperty1": "sampledata",
"MyCustomProperty2": null,
"CustomDatasourceProperty": 0,
"ShowPageForSearchEngine": true,
"MetaTitle": "",
"SEOTitle": "",
"MetaDescription": "",
"CanonicalLink": "",
"SocialMetaTags": "",
"SeoPriority": 0.0,
"EnableAMP": false,
"AMPContent": "",
"OpenGraphProperties": {
"title": null,
"type": null,
"url": null,
"locale": null,
"image": null
},
"ExternalId": 0,
"Params": {}
},
{
"Id": 2264,
"Name": "Javascript",
"Url": "/demo-web-technologies/javascript",
"Url_List": [
"/demo-web-technologies/javascript"
],
"UrlSlug": "javascript",
"ParentId": 2253,
"ParentId_List": [
-1
],
"ParentName": "",
"ParentUrl": "",
"TemplateName": "DEMO Companion Site",
"Module_Alias": "DEMOWebTechnologies",
"Module_ID": 2253,
"Enabled": true,
"ReleaseDate": "2018-11-24T18:00:00",
"ExpiryDate": "2099-12-10T18:00:00",
"SiteSearchKeywords": [],
"Description": "<p><strong>JavaScript</strong> (JS) is the name of Netscape Communications Corporation's and now the Mozilla’s foundation implementation of the <em>ECMAScript</em> standard, a scripting language based on the concept of prototype based programming.</p><p>The language is best known for its use in websites (as client side JavaScript), but is also used to enable scripting access to objects embedded in other applications.</p><p><strong>IMPORTANT</strong>: JavaScript is not Java!</p><p>JS can be used to do various things but it primarily comes into hand when:</p><ul><li>doing browser detection</li><li>handling cookies</li><li>controlling browsers</li><li>validating forms</li><li>setting CSS properties dynamically (see <a href=\"http://www.comptechdoc.org/independent/web/cgi/javamanual/javastyle.html\" rel=\"nofollow\">http://www.comptechdoc.org/independent/web/cgi/javamanual/javastyle.html</a>), eg. <em>element.style.border=\"1px solid black\"</em></li></ul>",
"Weighting": 0,
"DisableForSiteSearch": false,
"CreatedByMemberId": "0",
"ItemCategories": [],
"ItemCategoryIdList": [],
"ItemTags": [],
"Author": 0,
"Author_Name": "",
"Author_Url": "",
"Item_Rating": 0,
"MyCustomProperty1": null,
"MyCustomProperty2": null,
"CustomDatasourceProperty": 0,
"ShowPageForSearchEngine": true,
"MetaTitle": "",
"SEOTitle": "",
"MetaDescription": "",
"CanonicalLink": "",
"SocialMetaTags": "",
"SeoPriority": 0.0,
"EnableAMP": false,
"AMPContent": "",
"OpenGraphProperties": {
"title": null,
"type": null,
"url": null,
"locale": null,
"image": null
},
"ExternalId": 0,
"Params": {}
},
{
"Id": 2265,
"Name": "Liquid",
"Url": "/demo-web-technologies/liquid",
"Url_List": [
"/demo-web-technologies/liquid"
],
"UrlSlug": "liquid",
"ParentId": 2253,
"ParentId_List": [
-1
],
"ParentName": "",
"ParentUrl": "",
"TemplateName": "",
"Module_Alias": "DEMOWebTechnologies",
"Module_ID": 2253,
"Enabled": true,
"ReleaseDate": "2018-11-24T18:00:00",
"ExpiryDate": "2099-12-10T18:00:00",
"SiteSearchKeywords": [],
"Description": "<p>Liquid is an open-source template language created by Shopify and written in Ruby. It is the backbone of Shopify themes and is used to load dynamic content on storefronts.</p><p>Liquid has been in production use at Shopify since 2006 and is now used by many other hosted web applications.</p>",
"Weighting": 0,
"DisableForSiteSearch": false,
"CreatedByMemberId": "0",
"ItemCategories": [],
"ItemCategoryIdList": [],
"ItemTags": [],
"Author": 0,
"Author_Name": "",
"Author_Url": "",
"Item_Rating": 0,
"MyCustomProperty1": null,
"MyCustomProperty2": null,
"CustomDatasourceProperty": 0,
"ShowPageForSearchEngine": true,
"MetaTitle": "",
"SEOTitle": "",
"MetaDescription": "",
"CanonicalLink": "",
"SocialMetaTags": "",
"SeoPriority": 0.0,
"EnableAMP": false,
"AMPContent": "",
"OpenGraphProperties": {
"title": null,
"type": null,
"url": null,
"locale": null,
"image": null
},
"ExternalId": 0,
"Params": {}
}
]
}
Accessing the Data
JSON Output
You can output the full JSON for your component data by referencing the root Liquid object {{this}}
in your module’s layouts, or directly on your page, if using the collectionVariable
parameter in your component tag.
For example:
{% component type: ... collectionVariable: "myData" %}
You can then render the JSON like so:
{{myData}}
For more details on using this approach, see Part 2 of the free ‘Learning Liquid Course’.
Rendering Property Values
This data is accessible in two main ways:
1. Using Liquid in the specified Layout via the this
object.
{{this['url']}}
2. Directly on the Page or Template via a Liquid Collection if collectionVariable
was added to the Component tag.
An example using collectionVariable
with value "webTech" for a Custom Module called "Web Technologies":
{% component type: "module", source: "Web Technologies", layout: "List 1", collectionVariable: "webTech" %}
Looping through the collection to render all the item URLs in a list, giving us:
- /demo-web-technologies/css
- /demo-web-technologies/html
- /demo-web-technologies/javascript
- /demo-web-technologies/liquid
The code:
<ul>
{% for i in webTech.items %}
<li>{{i['url']}}</li>
{% endfor %}
</ul>
Accessing a specific item within the collection. In this case the third item (zero based index), which in our example would render the value /web-technologies/javascript/
{{webTech.items[2]['url']}}
Counter
Along with the data output above, there is also a special liquid tag available {{counter}}
which increments for each item. This tag is only available within Layouts when object: "item"
is used in the Component tag.
This module component fetches data relating to Blog Posts.
{% component type: "module", source: "Blog Post", layout: "List" %}
Parameters and Options
module (default)
module_of_member
This is the name of the entity that needs to be used for the component retrieving function.
module
is the standard retrieving function to retrieve all items.
module_of_member
retrieves only those items 'Added by' the currently logged in user (identified by the CreatedByMemberId
property in the module items Liquid data).
The 'Added by' System Property will only be available where the modules settings have 'Allow Add New Items' turned on under the 'Site User Permissions'.
Blog Post (default)
List (default)
<Your Layout name>
The layout name you want to use for rendering the component. The layout name is referenced from the available Layouts of the source specified.
While this parameter is required to render your Layout markup, if the parameter is blank, has an incorrectly referenced Layout, or is removed altogether then the component will still output the modules item data to a Liquid collection which can be accessed via the collectionVariable
parameter.
id
parentid
name
weighting
url
urlslug
releasedate
expirydate
LastUpdatedDate
Author
ItemCategories
ItemTags
<CustomPropertyName>
...and any other top level properties available for the module
Remove spaces from custom property names here.
<your value>
Liquid variables can be used here also. If present but no value set, no items will be returned.
id
parentid
name
weighting
url
urlslug
releasedate
expirydate
LastUpdatedDate
Author
ItemCategories
ItemTags
<CustomPropertyName>
...and any other top level properties available for the module
Remove spaces from custom property names here.
ASC (default)
DESC
ASC
sorts the items in ascending order while DESC
sorts in descending order (based on alpha/numeric or date sorting).If empty or not present, alpha/numeric sorting will be used.
false (default)
true
false
items will sort by their weighting values first, followed by any sortBy properties (or the default alpha/numeric sorting if sortBy is empty or not present). If true
item weightings will be ignored and sorting will only be applied via sortBy or default sorting.false (default)
true
If used in conjunction with sortBy, that sorting criteria will be applied to the randomly retrieved results. So, if retrieving all, or most, of the items they will not appear to be random since they will then be sorted back into a logical order. To overcome this, set the sortBy parameter to 'enabled' (or another unused property) as this will not provide any viable sorting criteria* and the items will not be sorted from their initial random order.
* Unless there are weighted items, which will always override the random option.
10 (default)
<integer>
true (default)
false
This is useful for avoiding pagniation affects for a specific component when multiple components of the same module are output on the same page and do use pagination.
false (default)
true
<Your custom message>
Liquid variables are supported here, although Liquid logic tags and HTML are not.
If using Liquid variables with filters added, be sure to change any double quotes to single quotes. For eg: emptyMessage: “{{ myVariable | prepend: 'Error: ' }}”
To use HTML in your empty message, first capture it using a Liquid capture, then insert the capture variable into the emptyMessage parameter.
item (default)
collection
item
returns each item iteratively, one after another, for output (generally, output to a container element with no need for looping through the data).collection
returns all items as one collection for output (your container element and looping logic would be handled in the Components Layout).<yourLiquidVariableName>
Your collectionVariable value must only contain English letters, numbers or underscores. Spaces or special characters are not supported.
false (default)
true
Allows search parameters in the URL to override the components output. Therefore, this parameter can be used to output module specific search results from a submitted search form.
Likewise, Tag, Category, and Archive components can be used in conjunction with this parameter for filtering the module's output.
URL search parameters will override any corresponding parameters in the component. If no search parameters are present in the URL, isSearchResult will be ignored.
Any value
other than true
, (including an empty value), will disable the search functionality and the component will output its regular data.
{'prop_ParentId':'1234', 'prop_ReleaseDate_Min':'2018-07-01', 'prop_ReleaseDate_Max':'2018-07-31', 'prop_KeyWords':'Your Keywords', 'prop_ItemTags':['tag1','tag2'], 'page':'2'}
Allows a search on the module without search parameters needed in the URL. Instead, search parameters are added to the value
of this parameter. Therefore, this parameter can be used to output module specific search results from hard-coded (or Liquid) values without the use of a search form.
Added search parameters will override any corresponding parameters otherwise configured on the component. If no search parameters are present, searchScope will be ignored.
This value
supports Liquid and can therefore be constructed with Liquid data/variables.
<your custom value>
Your <customParameter> name must only contain English letters, numbers or underscores. Spaces or special characters are not supported.
You can use HTML as the value here, just be sure to change any double quotes in your HTML to single quotes.
Also, see here for a tutorial on using Custom Paramters.
Liquid Output
The below example has 3 sample items
but is otherwise the default structure you will get from this Component.
{
"Params": {
"source": "Blog Post",
"layout": "",
"type": "module",
"limit": "3",
"collectionvariable": "allPosts"
},
"Pagination": {
"CurrentPage": 1,
"ItemsPerPage": 3,
"NumberOfPages": 3,
"TotalItemsCount": 7
},
"Parent": {
"Id": 2142,
"Name": "module (Blog Post)",
"Url": "/component-types/module-blog-post",
"Url_List": [
"/component-types/module-blog-post"
],
"UrlSlug": "module-blog-post",
"ParentId": 2127,
"ParentId_List": [
2127
],
"ParentName": "Liquid Components",
"ParentUrl": "/component-types",
"TemplateName": "Docs Template",
"Module_Alias": "DocumentationPost",
"Module_ID": 1870,
"Enabled": true,
"ReleaseDate": "2018-09-04T23:00:00",
"ExpiryDate": "2099-12-09T00:00:00",
"SiteSearchKeywords": [],
"Description": "<p>This module component fetches data relating to Blog Posts.</p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n\r\n{% component type: \"snippet\", alias: \"section_parameters\" %}\r\n\r\n{% component type: \"json\", source_type:\"string\", source:\"{{tabularData}}\", layout:\"/snippets/tabularJSON.layout\" %}\r\n</section>\r\n\r\n{% component type: \"snippet\", alias: \"section_output\" %}\r\n{% component source: \"Blog Post\", layout: "", type: \"module\", limit: \"3\", collectionVariable: \"allPosts\" %}\r\n<p>The below example has 3 sample <code>items</code> but is otherwise the default structure you will get from this Component.</p>\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{allPosts}}\", lang: \"json\" %}\r\n</section>\r\n\r\n{% component type: \"snippet\", alias: \"section_accessing_data\" %}\r\n\r\n<p>This data is accessible in two main ways:</p>\r\n\r\n<p>1. Using Liquid in the specified Layout via the <code>this</code> object.</p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n<p>2. Directly on the Page or Template via a Liquid Collection if <code>collectionVariable</code> was added to the Component tag.</p>\r\n\r\n<p>An example using <code>collectionVariable</code> with value \"allPosts\" to list all \"Blog Posts\" across the site:</p>\r\n<p class=\"notice-note\">Here we suppress any Layout from rendering by setting <code>layout: \"\"</code> as an empty attribute.</p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n<p><em>Looping through the collection to render all the item URLs in a list, giving us:</em></p>\r\n\r\n<ul>\r\n \r\n <li>/demo-html-blog/demo-html-post</li>\r\n \r\n <li>/demo-custom-blog-2/sample2-post-one</li>\r\n \r\n <li>/demo-custom-blog-2/sample2-post-three</li>\r\n \r\n</ul>\r\n<br>\r\n<p><em>The code:</em></p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n<p><em>Accessing a specific item within the collection. In this case the third item (zero based index), which in our example would render the value <code>/demo-custom-blog-2/sample2-post-three</code></em></p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n</section>\r\n\r\n<section id=\"secListFilteredPosts\">\r\n <h3>List Posts from a specific Blog</h3>\r\n<p>If you have more than one Blog on your site the above examples will list Posts from all Blogs as one single collection. However, typically you'd want to list all Posts from only the Blog they belong to (their \"parent\" Blog).</p>\r\n<p>To do this we add the <code>filterBy</code> and <code>filterValue</code> attributes to the Component tag.</p>\r\n<p>Typically, you would be listing Blog specific Posts on your Blog detail page/index page. In which case you would be editing the 'General Blog Layout' to insert your Component tag, which would look like this:</p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n<p>As we are within the Blog's detail Layout (which represents the 'parent' Blog) we can reference its ID for the filter value using <code>{{this['id']}}</code> and instruct the Component tag to filter the Posts only by their parent (<code>filterBy: \"parentID\"</code>) - giving us only the relevant Posts for the current Blog.</p>\r\n<p>You may however, want to render a list of Posts on a standard page or within another modules layout, where the Post's parent ID (the Blog it belongs to) is not readily available to us in the Liquid scope. In this case you would need to manually hardcode the desired parent Blog's ID into the component tag in place of the above Liquid generated ID (<code>filterValue: \"1234\"</code>).</p>\r\n<p class=\"notice-tip\">To obtain the Blog's ID from the admin, go to that Blog's list view (where you can see all of the Posts) and note the number in the URL address bar shown after the <code>parentID=</code> parameter.</p>\r\n</section>\r\n</section>\r\n\r\n{% component type: \"snippet\", alias: \"section_counter\" %}\r\n</section>\r\n",
"Weighting": 969,
"DisableForSiteSearch": false,
"CreatedByMemberId": "0",
"ItemCategories": [],
"ItemCategoryIdList": [],
"ItemTags": [
"Blogs"
],
"Author": 0,
"Author_Name": "",
"Author_Url": "",
"Item_Rating": 0,
"Active": true,
"IgnoreUpdates": true,
"UpdatesLog": "<ul>\n <li>27-Oct-2020 | 5.6.0 | Added 'ignoreWeighting' parameter</li>\n <li>'module_of_member' parameter details added.</li>\n</ul>",
"ExternalResources": "<ul><li><a href=\"/demo-cs/all-posts\">Demo Site All Posts</a></li><li><a href=\"/demo-html-blog\">Demo Site Blog</a></li></ul>",
"AdditionalRelatedArticle": 0,
"AdditionalRelatedArticle2": 0,
"Authors": "2418",
"ShowPageForSearchEngine": true,
"MetaTitle": "",
"SEOTitle": "",
"MetaDescription": "",
"CanonicalLink": "",
"SocialMetaTags": "",
"SeoPriority": 0.8,
"EnableAMP": false,
"AMPContent": "",
"OpenGraphProperties": {
"title": null,
"type": null,
"url": null,
"locale": null,
"image": null
},
"ExternalId": 0,
"Params": {
"source": "Documentation Post",
"layout": "Body Detail",
"filterby": "id",
"filtervalue": "2142",
"limit": "1",
"type": "snippet",
"alias": "section_output",
"data": "\r\n{% component type: \"module\", source: \"Blog Post\", layout: \"List\" %}\r\n",
"lang": "liquid",
"name": "SECTION Output",
"content": "<section id=\"secOutput\">\n <h2>Liquid Output</h2>",
"enabled": true,
"required": "true",
"values": "List <em>(default)</em><br><Your Layout name>"
}
},
"Items": [
{
"Id": 2280,
"Name": "DEMO HTML Post",
"Url": "/demo-html-blog/demo-html-post",
"Url_List": [
"/demo-html-blog/demo-html-post"
],
"UrlSlug": "demo-html-post",
"ParentId": 2279,
"ParentId_List": [
2279
],
"ParentName": "DEMO HTML Blog",
"ParentUrl": "/demo-html-blog",
"TemplateName": "DEMO Companion Site",
"Module_Alias": "BlogPost",
"Module_ID": 1534,
"Enabled": true,
"ReleaseDate": "2018-11-25T16:55:00",
"ExpiryDate": "2099-12-10T16:55:00",
"SiteSearchKeywords": [],
"Description": "<p>Orci phasellus egestas tellus rutrum tellus pellentesque. Sed enim ut sem viverra aliquet. Sed euismod nisi porta lorem mollis aliquam ut porttitor. Eget duis at tellus at urna condimentum mattis pellentesque. A condimentum vitae sapien pellentesque habitant morbi tristique senectus et. Viverra aliquet eget sit amet tellus cras adipiscing enim.</p><p><span class=\"fr-emoticon fr-deletable fr-emoticon-img\" style=\"background: url(https://cdnjs.cloudflare.com/ajax/libs/emojione/2.0.1/assets/svg/1f60e.svg);\"> </span> </p>\r\n",
"Weighting": 0,
"DisableForSiteSearch": false,
"CreatedByMemberId": "0",
"ItemCategories": [
"Group 1/G1 Sub Cat I/G1 Sub Sub Cat I"
],
"ItemCategoryIdList": [
1353
],
"ItemTags": [],
"Author": 2274,
"Author_Name": "DEMO Author One",
"Author_Url": "/demo-author-one",
"Item_Rating": 90,
"Image": "",
"ShowPageForSearchEngine": true,
"MetaTitle": "",
"SEOTitle": "",
"MetaDescription": "",
"CanonicalLink": "",
"SocialMetaTags": "",
"SeoPriority": 0.5,
"EnableAMP": false,
"AMPContent": "",
"OpenGraphProperties": {
"title": null,
"type": null,
"url": null,
"locale": null,
"image": null
},
"ExternalId": 0,
"Params": {}
},
{
"Id": 2468,
"Name": "Sample2 Post One ",
"Url": "/demo-custom-blog-2/sample2-post-one",
"Url_List": [
"/demo-custom-blog-2/sample2-post-one"
],
"UrlSlug": "sample2-post-one",
"ParentId": 2464,
"ParentId_List": [
2464
],
"ParentName": "DEMO Custom Blog 2",
"ParentUrl": "/demo-custom-blog-2",
"TemplateName": "DEMO Companion Site",
"Module_Alias": "BlogPost",
"Module_ID": 1534,
"Enabled": true,
"ReleaseDate": "2019-10-06T20:00:00",
"ExpiryDate": "2099-12-12T00:00:00",
"SiteSearchKeywords": [],
"Description": "<p>Cras elementum viverra nisl, at convallis urna tristique eu. Nam ut erat libero. In posuere turpis congue nunc rhoncus laoreet. In volutpat mauris vitae augue bibendum pharetra. Nullam pharetra, ligula ac ultricies porta, erat justo rhoncus nisl, sit amet tempus diam leo vitae turpis. Nam id lorem fringilla, finibus nulla efficitur, gravida lacus. Curabitur in molestie arcu. Sed eget tempor enim, vitae sagittis nisi. Sed porttitor euismod ex, accumsan lobortis quam lacinia quis. Aliquam dignissim vestibulum neque, ornare tristique elit sodales non. Interdum et malesuada fames ac ante ipsum primis in faucibus.</p><p>Aliquam id mattis elit, eu dictum sem. Suspendisse velit diam, pellentesque in commodo nec, tristique vel quam. Donec dapibus gravida volutpat. Nunc tellus metus, laoreet vel odio ut, fringilla posuere velit. Aliquam ut dignissim tellus, et condimentum eros. In aliquam leo nibh, sed facilisis nunc condimentum vitae. Duis vestibulum pellentesque orci, quis volutpat tellus commodo eget. Morbi congue hendrerit euismod. Maecenas vel porttitor sapien. Nam a leo vitae lectus rutrum feugiat. Sed mollis hendrerit odio, in porttitor metus cursus at. Sed vel tellus venenatis, maximus diam in, volutpat massa. Duis sodales, quam id eleifend pretium, felis tortor ullamcorper eros, ut euismod nisl nibh vel est. Vestibulum varius, quam sit amet placerat consectetur, est leo pretium ante, ut bibendum augue elit sit amet velit.</p><p>Donec congue ligula non felis viverra, sed aliquet nisl suscipit. Sed porta ultricies est tempor finibus. Sed tempor mollis nunc. Pellentesque posuere elit et elit varius commodo. Nulla facilisi. Vivamus condimentum nunc sit amet lacus condimentum sagittis at ut dui. Quisque in quam enim. Duis egestas, nisi quis auctor placerat, est sem pretium mi, nec pharetra tortor arcu eu magna. Nullam sed lectus ac nibh placerat vulputate id ut urna. Aenean ullamcorper sed sem id lobortis. Integer ornare bibendum maximus. Quisque venenatis eleifend lorem, at pharetra est fermentum semper. Vivamus turpis orci, molestie eget consequat nec, rutrum a quam. Morbi eu ullamcorper elit. Phasellus a vehicula velit.</p><p>Praesent dignissim sagittis leo ut porttitor. Integer nisi enim, tristique a ligula vel, mattis gravida metus. Praesent sed cursus turpis, pellentesque facilisis risus. Ut ut tortor elementum, euismod nisl nec, rhoncus justo. In lobortis tempus ipsum ut venenatis. Etiam a mi vel ante tempor aliquet sed nec leo. Sed euismod neque at tortor ultrices dapibus. Sed ipsum libero, viverra vel sem a, fringilla fringilla eros. Vivamus sit amet arcu malesuada mi mattis vulputate vel laoreet diam. Vestibulum eu tellus lectus.</p><p>Aenean risus tellus, posuere at ligula eu, elementum rhoncus lacus. Aenean non urna vulputate, aliquam eros ut, pretium ex. Morbi elementum erat vitae est dapibus interdum. Nam sed rhoncus nunc. Sed posuere ullamcorper eros, sed efficitur nisi maximus id. Sed nec aliquam ligula. Quisque ultricies pellentesque nulla, quis auctor eros blandit malesuada. Sed purus leo, imperdiet at justo id, bibendum convallis ex. Donec sagittis, urna vitae posuere viverra, purus purus imperdiet enim, id lacinia lacus velit sit amet neque. Fusce vestibulum tortor ac tortor venenatis vehicula. Donec nec lorem sed nunc pharetra finibus. Pellentesque porttitor augue ex, et mattis erat gravida in.</p>",
"Weighting": 0,
"DisableForSiteSearch": true,
"CreatedByMemberId": "0",
"ItemCategories": [
"Group 2",
"Sample Category"
],
"ItemCategoryIdList": [
1346,
1348
],
"ItemTags": [
"blog posts",
"demo"
],
"Author": 2274,
"Author_Name": "DEMO Author One",
"Author_Url": "/demo-author-one",
"Item_Rating": 0,
"Image": "/images/template-courses.jpg",
"ShowPageForSearchEngine": false,
"MetaTitle": "",
"SEOTitle": "",
"MetaDescription": "",
"CanonicalLink": "",
"SocialMetaTags": "",
"SeoPriority": 0.5,
"EnableAMP": false,
"AMPContent": "",
"OpenGraphProperties": {
"title": null,
"type": null,
"url": null,
"locale": null,
"image": null
},
"ExternalId": 0,
"Params": {}
},
{
"Id": 2470,
"Name": "Sample2 Post Three",
"Url": "/demo-custom-blog-2/sample2-post-three",
"Url_List": [
"/demo-custom-blog-2/sample2-post-three"
],
"UrlSlug": "sample2-post-three",
"ParentId": 2464,
"ParentId_List": [
2464
],
"ParentName": "DEMO Custom Blog 2",
"ParentUrl": "/demo-custom-blog-2",
"TemplateName": "DEMO Companion Site",
"Module_Alias": "BlogPost",
"Module_ID": 1534,
"Enabled": true,
"ReleaseDate": "2019-11-05T00:00:00",
"ExpiryDate": "2099-12-11T13:00:00",
"SiteSearchKeywords": [],
"Description": "<p>Cras elementum viverra nisl, at convallis urna tristique eu. Nam ut erat libero. In posuere turpis congue nunc rhoncus laoreet. In volutpat mauris vitae augue bibendum pharetra. Nullam pharetra, ligula ac ultricies porta, erat justo rhoncus nisl, sit amet tempus diam leo vitae turpis. Nam id lorem fringilla, finibus nulla efficitur, gravida lacus. Curabitur in molestie arcu. Sed eget tempor enim, vitae sagittis nisi. Sed porttitor euismod ex, accumsan lobortis quam lacinia quis. Aliquam dignissim vestibulum neque, ornare tristique elit sodales non. Interdum et malesuada fames ac ante ipsum primis in faucibus.</p><p>Aliquam id mattis elit, eu dictum sem. Suspendisse velit diam, pellentesque in commodo nec, tristique vel quam. Donec dapibus gravida volutpat. Nunc tellus metus, laoreet vel odio ut, fringilla posuere velit. Aliquam ut dignissim tellus, et condimentum eros. In aliquam leo nibh, sed facilisis nunc condimentum vitae. Duis vestibulum pellentesque orci, quis volutpat tellus commodo eget. Morbi congue hendrerit euismod. Maecenas vel porttitor sapien. Nam a leo vitae lectus rutrum feugiat. Sed mollis hendrerit odio, in porttitor metus cursus at. Sed vel tellus venenatis, maximus diam in, volutpat massa. Duis sodales, quam id eleifend pretium, felis tortor ullamcorper eros, ut euismod nisl nibh vel est. Vestibulum varius, quam sit amet placerat consectetur, est leo pretium ante, ut bibendum augue elit sit amet velit.</p><p>Donec congue ligula non felis viverra, sed aliquet nisl suscipit. Sed porta ultricies est tempor finibus. Sed tempor mollis nunc. Pellentesque posuere elit et elit varius commodo. Nulla facilisi. Vivamus condimentum nunc sit amet lacus condimentum sagittis at ut dui. Quisque in quam enim. Duis egestas, nisi quis auctor placerat, est sem pretium mi, nec pharetra tortor arcu eu magna. Nullam sed lectus ac nibh placerat vulputate id ut urna. Aenean ullamcorper sed sem id lobortis. Integer ornare bibendum maximus. Quisque venenatis eleifend lorem, at pharetra est fermentum semper. Vivamus turpis orci, molestie eget consequat nec, rutrum a quam. Morbi eu ullamcorper elit. Phasellus a vehicula velit.</p><p>Praesent dignissim sagittis leo ut porttitor. Integer nisi enim, tristique a ligula vel, mattis gravida metus. Praesent sed cursus turpis, pellentesque facilisis risus. Ut ut tortor elementum, euismod nisl nec, rhoncus justo. In lobortis tempus ipsum ut venenatis. Etiam a mi vel ante tempor aliquet sed nec leo. Sed euismod neque at tortor ultrices dapibus. Sed ipsum libero, viverra vel sem a, fringilla fringilla eros. Vivamus sit amet arcu malesuada mi mattis vulputate vel laoreet diam. Vestibulum eu tellus lectus.</p><p>Aenean risus tellus, posuere at ligula eu, elementum rhoncus lacus. Aenean non urna vulputate, aliquam eros ut, pretium ex. Morbi elementum erat vitae est dapibus interdum. Nam sed rhoncus nunc. Sed posuere ullamcorper eros, sed efficitur nisi maximus id. Sed nec aliquam ligula. Quisque ultricies pellentesque nulla, quis auctor eros blandit malesuada. Sed purus leo, imperdiet at justo id, bibendum convallis ex. Donec sagittis, urna vitae posuere viverra, purus purus imperdiet enim, id lacinia lacus velit sit amet neque. Fusce vestibulum tortor ac tortor venenatis vehicula. Donec nec lorem sed nunc pharetra finibus. Pellentesque porttitor augue ex, et mattis erat gravida in.</p>",
"Weighting": 0,
"DisableForSiteSearch": false,
"CreatedByMemberId": "0",
"ItemCategories": [
"Group 1/G1 Sub Cat I",
"Group 2/G2 Sub Cat II"
],
"ItemCategoryIdList": [
1349,
1352
],
"ItemTags": [
"blog posts",
"sample"
],
"Author": 2274,
"Author_Name": "DEMO Author One",
"Author_Url": "/demo-author-one",
"Item_Rating": 0,
"Image": "/images/home-img-01.jpg",
"ShowPageForSearchEngine": false,
"MetaTitle": "",
"SEOTitle": "",
"MetaDescription": "",
"CanonicalLink": "",
"SocialMetaTags": "",
"SeoPriority": 0.5,
"EnableAMP": false,
"AMPContent": "",
"OpenGraphProperties": {
"title": "My Open Graph Title",
"type": "article",
"url": "https://www.mywesite.com/demo-custom-blog-2/sample2-post-three",
"locale": "en_US",
"image": "https://www.mywesite.com/images/sample-image.jpg"
},
"ExternalId": 0,
"Params": {}
}
]
}
Accessing the Data
JSON Output
You can output the full JSON for your component data by referencing the root Liquid object {{this}}
in your module’s layouts, or directly on your page, if using the collectionVariable
parameter in your component tag.
For example:
{% component type: ... collectionVariable: "myData" %}
You can then render the JSON like so:
{{myData}}
For more details on using this approach, see Part 2 of the free ‘Learning Liquid Course’.
Rendering Property Values
This data is accessible in two main ways:
1. Using Liquid in the specified Layout via the this
object.
{{this['url']}}
2. Directly on the Page or Template via a Liquid Collection if collectionVariable
was added to the Component tag.
An example using collectionVariable
with value "allPosts" to list all "Blog Posts" across the site:
Here we suppress any Layout from rendering by setting layout: ""
as an empty attribute.
{% component type: "module", source: "Blog Posts", layout: "", collectionVariable: "allPosts" %}
Looping through the collection to render all the item URLs in a list, giving us:
- /demo-html-blog/demo-html-post
- /demo-custom-blog-2/sample2-post-one
- /demo-custom-blog-2/sample2-post-three
The code:
<ul>
{% for i in allPosts.items %}
<li>{{i['url']}}</li>
{% endfor %}
</ul>
Accessing a specific item within the collection. In this case the third item (zero based index), which in our example would render the value /demo-custom-blog-2/sample2-post-three
{{allPosts.items[2]['url']}}
List Posts from a specific Blog
If you have more than one Blog on your site the above examples will list Posts from all Blogs as one single collection. However, typically you'd want to list all Posts from only the Blog they belong to (their "parent" Blog).
To do this we add the filterBy
and filterValue
attributes to the Component tag.
Typically, you would be listing Blog specific Posts on your Blog detail page/index page. In which case you would be editing the 'General Blog Layout' to insert your Component tag, which would look like this:
{% component type: "module", source: "Blog Posts", layout: "List", filterBy: "parentId", filterValue: "{{this['id']}}" %}
As we are within the Blog's detail Layout (which represents the 'parent' Blog) we can reference its ID for the filter value using {{this['id']}}
and instruct the Component tag to filter the Posts only by their parent (filterBy: "parentID"
) - giving us only the relevant Posts for the current Blog.
You may however, want to render a list of Posts on a standard page or within another modules layout, where the Post's parent ID (the Blog it belongs to) is not readily available to us in the Liquid scope. In this case you would need to manually hardcode the desired parent Blog's ID into the component tag in place of the above Liquid generated ID (filterValue: "1234"
).
To obtain the Blog's ID from the admin, go to that Blog's list view (where you can see all of the Posts) and note the number in the URL address bar shown after the parentID=
parameter.
Counter
Along with the data output above, there is also a special liquid tag available {{counter}}
which increments for each item. This tag is only available within Layouts when object: "item"
is used in the Component tag.
This component outputs data relating to a specific Form.
{% component type: "form", alias: "<form_alias>" %}
Parameters and Options
form
This is the name of the entity that needs to be used for the component retrieving function.
module
is the standard retrieving function to retrieve all items.
module_of_member
retrieves only those items 'Added by' the currently logged in user (identified by the CreatedByMemberId
property in the module items Liquid data).
The 'Added by' System Property will only be available where the modules settings have 'Allow Add New Items' turned on under the 'Site User Permissions'.
<alias_name>
<The Form's Layout>
<yourLiquidVariableName>
If using this parameter, the form will not render its layout.
Your collectionVariable value must only contain English letters, numbers or underscores. Spaces or special characters are not supported.
<number>
module
is the standard retrieving function to retrieve all items.
module_of_member
retrieves only those items 'Added by' the currently logged in user (identified by the CreatedByMemberId
property in the module items Liquid data).
The 'Added by' System Property will only be available where the modules settings have 'Allow Add New Items' turned on under the 'Site User Permissions'.
<ID>
module
is the standard retrieving function to retrieve all items.
module_of_member
retrieves only those items 'Added by' the currently logged in user (identified by the CreatedByMemberId
property in the module items Liquid data).
The 'Added by' System Property will only be available where the modules settings have 'Allow Add New Items' turned on under the 'Site User Permissions'.
<your custom value>
Your <customParameter> name must only contain English letters, numbers or underscores. Spaces or special characters are not supported.
You can use HTML as the value here, just be sure to change any double quotes in your HTML to single quotes.
Also, see here for a tutorial on using Custom Paramters.
Liquid Output
The below form example has 4 system fields and 2 custom fields and represents the typical data structure you will see from this Component.
{
"Name": "Sample Form",
"Alias": "sample_form",
"IsSubscription": false,
"EnableDefaultJSValidation": false,
"Fields": [
{
"Name": "Email",
"Alias": "Email",
"CreatedDateTime": "2021-06-28T18:03:40.45159",
"UpdateDateTime": "0001-01-01T00:00:00",
"Type": 7,
"IsMandatory": true,
"FieldGroupType": 1,
"Order": 0,
"Options": [],
"Id": "1388",
"FormId": "1382"
},
{
"Name": "reCAPTCHA v2",
"Alias": "ReCAPTCHAV2",
"CreatedDateTime": "2021-06-28T18:03:40.451601",
"UpdateDateTime": "0001-01-01T00:00:00",
"Type": 9,
"IsMandatory": true,
"FieldGroupType": 2,
"Order": 5,
"Options": [],
"Id": "1393",
"FormId": "1382"
},
{
"Name": "First Name",
"Alias": "FirstName",
"CreatedDateTime": "2021-06-28T18:03:40.451598",
"UpdateDateTime": "2022-05-11T15:32:06.413082",
"Type": 7,
"IsMandatory": true,
"FieldGroupType": 1,
"Order": 1,
"Options": [],
"Id": "1389",
"FormId": "1382"
},
{
"Name": "Phone",
"Alias": "Phone",
"CreatedDateTime": "2021-06-28T18:03:40.451599",
"UpdateDateTime": "2022-05-11T15:32:06.413082",
"Type": 7,
"IsMandatory": false,
"FieldGroupType": 1,
"Order": 3,
"Options": [],
"Id": "1391",
"FormId": "1382"
},
{
"Name": "Last Name",
"Alias": "LastName",
"CreatedDateTime": "2021-06-28T18:03:40.451598",
"UpdateDateTime": "2022-05-11T15:32:06.413082",
"Type": 7,
"IsMandatory": true,
"FieldGroupType": 1,
"Order": 2,
"Options": [],
"Id": "1390",
"FormId": "1382"
},
{
"Name": "Enquiry",
"Alias": "Enquiry",
"CreatedDateTime": "2021-06-28T18:03:40.4516",
"UpdateDateTime": "2022-05-11T15:32:06.413082",
"Type": 6,
"IsMandatory": true,
"FieldGroupType": 2,
"Order": 4,
"Options": [],
"Id": "1392",
"FormId": "1382"
}
],
"PaymentAmount": 0.0,
"ModuleItemId": 0,
"FormType": "Generic",
"ModuleName": "",
"UniqueId": "330d2a66-805f-49e8-ab33-59c72086a644",
"Parent": {
"Value": {
"Id": 1958,
"ModuleLayoutName": "Detail",
"Enabled": true,
"ReleaseDate": "2018-08-02T23:00:00",
"ExpiryDate": "2099-11-28T00:00:00",
"Weighting": 990,
"Item_Rating": 0,
"CodeEditor": true,
"ExternalId": 0,
"DisableForSiteSearch": false,
"Author_Name": null,
"Author_Url": null,
"Author": 0,
"SEOTitle": null,
"CustomProperties": "{\"31e8bc20-c904-481a-b47e-95304c4edcdc\": \"<ul>\\n <li>26-07-2023 | v6.9.1 | Added 'layout' parameter description</li>\\n <li>Added new payment 'type' property</li>\\n</ul>\", \"8aa52748-df22-4986-8131-f6a9ab1f048a\": 0, \"a11635f8-fa31-49d5-a0c0-2fb45d52caec\": \"<ul><li><a href=\\\"/demo-cs/contact\\\" rel=\\\"noopener noreferrer\\\" target=\\\"_blank\\\">A demo of the default form output used in this example</a></li></ul>\", \"b0ce44c2-314b-4ab2-b829-6baeb33b6a0e\": true, \"b2b960ff-e003-4b75-b760-9559e127e0b2\": false, \"cb88f1ea-ee57-498c-8781-a47e753b4c0e\": 0, \"e8ef1eaa-93bd-455d-b0ce-0cb5ea9c35a1\": \"2418\"}",
"LastUpdatedDate": "2023-07-25T20:36:47.853416",
"Module_Alias": "DocumentationPost",
"Module_Id": 1870,
"ParentName": "Liquid Components",
"ParentUrl": "/component-types",
"Name": "form",
"UrlSlug": "form",
"Url": "/component-types/form",
"MetaDescription": null,
"ShowPageForSearchEngine": true,
"CanonicalLink": null,
"MetaTitle": null,
"ParentId": 2127,
"Url_List": [
"/component-types/form"
],
"ParentId_List": [
2127
],
"EnableAMP": false,
"AMPContent": null,
"SocialMetaTags": null,
"OpenGraphPropertiesValue": null,
"SeoPriority": 0.8,
"Description": "<p>This component outputs data relating to a specific Form.</p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n{% component type: \"snippet\", alias: \"section_parameters\" %}\r\n\r\n{% component type: \"json\", source_type:\"string\", source:\"{{tabularData}}\", layout:\"/snippets/tabularJSON.layout\" %}\r\n</section>\r\n\r\n{% component type: \"snippet\", alias: \"section_output\" %}\r\n\r\n<p>The below form example has 4 system fields and 2 custom fields and represents the typical data structure you will see from this Component.</p>\r\n\r\n{% component type: \"form\", layout: "", alias: \"sample_form\", collectionVariable: \"data\" %}\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"json\" %}\r\n</section>\r\n\r\n<section id=\"secFieldTypeCodes\">\r\n <h2>Field Type Codes</h2>\r\n <p>From the data output you can identify the type of field created in the admin via it's <code>Type</code> property.<br>\r\n The various types are listed below:</p>\r\n <ul>\r\n <li>DateTime - <b>1</b></li>\r\n <li>CheckboxList & MailingLists - <b>2</b></li>\r\n <li>DropdownList - <b>3</b></li>\r\n <li>ListboxList - <b>4</b></li>\r\n <li>RadioList - <b>5</b></li>\r\n <li>Multiline - <b>6</b></li>\r\n <li>String - <b>7</b></li>\r\n <li>Boolean - <b>8</b></li>\r\n <li>ReCAPTCHAV2 & ReCAPTCHAV3 - <b>9</b></li>\r\n <li>Upload - <b>10</b></li>\r\n <li>Password - <b>11</b></li>\r\n <li>AcceptPayment - <b>12</b></li>\r\n <li>AcceptEventSubscription - <b>13</b></li>\r\n </ul>\r\n <p>System fields <code>Email, FirstName, LastName, Phone, Site, Address, City, State, ZipCode, Country, Status, Secure Zone Expiry Date, Secure Zone Expiry Duration</code> all use type <b>7</b>, and field <code>Notes</code> uses type <b>6</b>.</p>\r\n</section>\r\n\r\n{% component type: \"snippet\", alias: \"section_accessing_data\" %}\r\n\r\n<p>As an alternative, you can instead output the form data directly on the Page or Template via a Liquid Collection if <code>collectionVariable</code> was added to the Component tag.</p>\r\n\r\n<p>An example using <code>collectionVariable</code> with value \"formData\" is as follows:</p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n<p><em>Looping through the collection to render all the field names:</em></p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n<p><em>Accessing a specific item within the collection. In this case the third fields name (zero based index):</em></p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n</section>\r\n</section>\r\n",
"TemplateName": "Docs Template",
"ItemCategories": null,
"ItemCategoryIdList": null,
"ItemTags": [
"Forms"
],
"SiteSearchKeywords": null,
"ID": 1958,
"CreatedByMemberId": "0",
"IsHome": false,
"Pagination": {
"CurrentPage": 1,
"ItemsPerPage": 1,
"NumberOfPages": 1,
"TotalItemsCount": 1
},
"OpenGraphProperties": {
"title": null,
"type": null,
"url": null,
"locale": null,
"image": null
},
"Parent": {
"Value": {
"Id": 2361,
"ModuleLayoutName": "Detail",
"Enabled": true,
"ReleaseDate": "2019-02-28T00:00:00",
"ExpiryDate": "2099-12-11T00:00:00",
"Weighting": 100,
"Item_Rating": 0,
"CodeEditor": true,
"ExternalId": 0,
"DisableForSiteSearch": false,
"Author_Name": null,
"Author_Url": null,
"Author": 0,
"SEOTitle": null,
"CustomProperties": "{\"31e8bc20-c904-481a-b47e-95304c4edcdc\": \"<ul><li>Added external resource link for BC to Treepl App conversion info.</li></ul>\", \"8aa52748-df22-4986-8131-f6a9ab1f048a\": 0, \"a11635f8-fa31-49d5-a0c0-2fb45d52caec\": \"<ul><li><a href=\\\"https://forum.treepl.co/t/bc-to-treepl-app-updates-announcements-and-discussions/497\\\" rel=\\\"noopener noreferrer\\\" target=\\\"_blank\\\" title=\\\"\\\">BC to Treepl CMS App - Liquid and Tag Conversions</a></li></ul>\", \"b0ce44c2-314b-4ab2-b829-6baeb33b6a0e\": true, \"b2b960ff-e003-4b75-b760-9559e127e0b2\": true, \"cb88f1ea-ee57-498c-8781-a47e753b4c0e\": 0, \"e8ef1eaa-93bd-455d-b0ce-0cb5ea9c35a1\": \"2418\"}",
"LastUpdatedDate": "2022-11-24T17:20:14.870332",
"Module_Alias": "DocumentationPost",
"Module_Id": 1870,
"ParentName": "Liquid Objects & Usage",
"ParentUrl": "/liquid",
"Name": "BC Liquid Comparisons",
"UrlSlug": "bc-liquid-comparisons",
"Url": "/liquid/bc-liquid-comparisons",
"MetaDescription": null,
"ShowPageForSearchEngine": true,
"CanonicalLink": null,
"MetaTitle": null,
"ParentId": 1881,
"Url_List": [
"/liquid/bc-liquid-comparisons"
],
"ParentId_List": [
1881
],
"EnableAMP": false,
"AMPContent": null,
"SocialMetaTags": null,
"OpenGraphPropertiesValue": null,
"SeoPriority": 0.0,
"Description": "<p>Below are some typical Business Catalyst (BC) legacy Liquid and tags and their closest Treepl CMS comparisons that you may have found left over in old code.</p>\r\n\r\n \r\n <table style=\"width: 100%;\">\r\n <thead>\r\n <tr>\r\n <th><h2 id=\"secItem\">Item Data</h2></th>\r\n </tr>\r\n </thead>\r\n <tbody> \r\n \r\n <tr>\r\n <td style=\"font-weight: normal;\"><b>BC: Page Name</b><br><code>{module_pagename}</code><br><small>eg: \"About\"</small>\r\n <br class=\"space\"><br class=\"space\">\r\n <b>Treepl CMS:</b><br><code>{{this.name}}</code><br><small>Name of current item (within the context/scope of the template/layout where it is placed)</small></td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-weight: normal;\"><b>BC: Page Title</b><br><code>{module_pagetitle}</code><br><small>eg: \"About ABC Company\"</small>\r\n <br class=\"space\"><br class=\"space\">\r\n <b>Treepl CMS:</b><br><code>{{this.seotitle}}</code><br><small>Meta title of current item (within the context/scope of the template/layout where it is placed)</small></td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-weight: normal;\"><b>BC: Page ID</b><br><code>{module_oid}</code><br><small>eg: \"12345\"</small>\r\n <br class=\"space\"><br class=\"space\">\r\n <b>Treepl CMS:</b><br><code>{{this.id}}</code><br><small>ID of current item (within the context/scope of the template/layout where it is placed)</small></td>\r\n </tr>\r\n </tbody>\r\n</table>\r\n <div class=\"tab-content faqsOpenCloseHolder\">\r\n <div class=\"faqs-open-close \">\r\n <a class=\"opener\" href=\"#\"><i class=\"fas fa-angle-right\"></i>\"this\" Documentation</a>\r\n <div class=\"slide js-slide-hidden\">\r\n {% component source: \"Documentation Post\", layout: \"Body Detail\", filterBy: \"id\", filterValue: \"2324\", limit: \"1\", type: \"module\" %}\r\n </div>\r\n </div>\r\n </div>\r\n <p><br><br></p> \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n<table style=\"width: 100%;\">\r\n <thead>\r\n <tr>\r\n <th><h2 id=\"secSystem\">System Data</h2></th>\r\n </tr>\r\n </thead>\r\n <tbody> \r\n <tr>\r\n <td style=\"font-weight: normal;\"><b>BC: Page URL and URL Parameters</b><br><code>{module_url param=\"param1\"} and {module_pageaddress}</code><br><small>eg: {<br>\r\n \"ID\": \"/test2.html\",<br>\r\n \"question\": \"true\",<br>\r\n}</small>\r\n<br class=\"space\"><br class=\"space\">\r\n<b>Treepl CMS:</b><br><code>{{request.request_url}}</code><br><small>Output: {<br>\r\n \"href\": \"https://docs.treepl.co/test2?question=true\",<br>\r\n \"origin\": \"https://docs.treepl.co\",<br>\r\n \"protocol\": \"https\",<br>\r\n \"hostname\": \"docs.treepl.co\",<br>\r\n \"path\": \"/test2\",<br>\r\n \"params\": {<br>\r\n \"question\": \"true\"<br>\r\n }<br>\r\n }</small></td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-weight: normal;\"><b>BC: Referral Address</b><br><code>{module_referreraddress}</code><br><small>eg: \"http://mysite.com/page1\"</small>\r\n <br class=\"space\"><br class=\"space\">\r\n <b>Treepl CMS:</b><br><code>{{request.request_data.referrer}}</code><br><small> </small></td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-weight: normal;\"><b>BC: Globals and Visitor IP Address</b><br><code>{module_visitoripaddress} and {{globals.visitor}}</code><br><small>eg: \"193.2.2.2\"<br><br>{<br>\r\n \"deviceClass\": \"desktop\",<br>\r\n \"ip\": \"193.2.2.2\",<br>\r\n \"country\": \"RO\",<br>\r\n \"userAgent\": \"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36\"<br>\r\n}</small>\r\n<br class=\"space\"><br class=\"space\">\r\n<b>Treepl CMS:</b><br><code>{{request.request_data}}</code><br><small>Output: {<br>\r\n \"ip\": \"193.2.2.2\",<br>\r\n \"is_mobile\": 0,<br>\r\n \"user_agent\": \"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36\",<br>\r\n \"referrer\": \"/page1\"<br>\r\n }</small></td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-weight: normal;\"><b>BC: Visitor Device Class</b><br><code>{system_visitordeviceclass}</code><br><small>eg: \"desktop\", \"phone\" or \"tablet\"</small>\r\n <br class=\"space\"><br class=\"space\">\r\n <b>Treepl CMS:</b><br><code>{{request.device_type}}</code><br><small>Output: \"Desktop\", \"Tablet\", \"Mobile\"</small></td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-weight: normal;\"><b>BC: Logged In User</b><br><code>{{globals.user}} and {module_isloggedin}</code><br><small>eg: \"1\" or \"0\"<br><br>{<br>\r\n \"firstname\": \"Alex\",<br>\r\n \"lastname\": \"Smith\",<br>\r\n \"fullname\": \"Alex Smith\",<br>\r\n \"email\": \"asmith@example.com\",<br>\r\n \"isLoggedIn\": true<br>\r\n}</small>\r\n<br class=\"space\"><br class=\"space\">\r\n<b>Treepl CMS:</b><br><code>{{request.is_logged}} and {{request.currentmember}}</code><br><small>Output: \"true\" or \"false\"<br><br>{<br>\r\n \"id\": 162,<br>\r\n \"email\": \"asmith@example.com\",<br>\r\n \"firstname\": \"Alex\",<br>\r\n \"lastname\": \"Smith\",<br>\r\n \"address\": null,<br>\r\n \"city\": null,<br>\r\n \"state\": null,<br>\r\n \"zipcode\": null,<br>\r\n \"country\": \"Australia\",<br>\r\n \"site\": null,<br>\r\n \"phone\": null,<br>\r\n \"createddatetime\": \"2018-11-21T15:17:22.717\",<br>\r\n \"updateddatetime\": \"2018-11-21T15:17:22.763\",<br>\r\n \"securezones\": [<br>\r\n {<br>\r\n \"id\": 2,<br>\r\n \"name\": \"Members Secure Zone\",<br>\r\n \"landingpageid\": 2541,<br>\r\n \"createddatetime\": \"2018-11-21T15:17:23.037\",<br>\r\n \"updateddatetime\": \"2018-11-21T15:17:23.037\"<br>\r\n }<br>\r\n ]<br>\r\n }</small></td>\r\n </tr>\r\n </tbody>\r\n</table>\r\n <div class=\"tab-content faqsOpenCloseHolder\">\r\n <div class=\"faqs-open-close \">\r\n <a class=\"opener\" href=\"#\"><i class=\"fas fa-angle-right\"></i>\"request\" Documentation</a>\r\n <div class=\"slide js-slide-hidden\">\r\n {% component source: \"Documentation Post\", layout: \"Body Detail\", filterBy: \"id\", filterValue: \"1964\", limit: \"1\", type: \"module\" %}\r\n </div>\r\n </div>\r\n </div>\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n<table style=\"width: 100%;\">\r\n <thead>\r\n <tr>\r\n <th><h2 id=\"secContent\">Content Modules</h2></th>\r\n </tr>\r\n </thead>\r\n <tbody> \r\n <tr>\r\n <td style=\"font-weight: normal;\"><b>BC: WebApp listing module</b><br><code>{module_webapps render=\"item|collection\" id=\"webappId|webappName\" filter=\"item\" itemId=\"123\" targetFrame=\"\" resultsPerPage=\"\" hideEmptyMessage=\"false\" rowCount=\"\" sortType=\"ALPHABETICAL\" collection=\"my_custom_collection_name\" template=\"/folder/template.tpl\"}</code><br><small>eg: <ul>\r\n <li>My WebApp Item 1</li>\r\n <li>My WebApp Item 2</li>\r\n <li>My WebApp Item 3</li>\r\n</ul></small>\r\n<br class=\"space\"><br class=\"space\">\r\n<b>Treepl CMS:</b><br><code>{% component type: \"module\", object: \"item|collection\", source: \"<Custom Module name/ID>\", filterBy: \"id\", filterValue: \"123\", limit: \"10\", emptyMessage: \"<your content>\", sortBy: \"name\", collectionVariable: \"my_custom_collection_name\", layout: \"List 1\" %}</code><br><small>Notes: No \"targetFrame\" or \"rowCount\" equivalents as no longer necessary.<br>Fully documented Component parameters below.</small></td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-weight: normal;\"><b>BC: Blog's Post listing module</b><br><code>{module_blogpostlist render=\"item|collection\" collection=\"my_custom_collection_name\" template=\"/folder/template.tpl\" blogId=\"12345\" rowCount=\"10\" tag=\"tag\"}</code><br><small>eg: <ul>\r\n <li>My Blog Post 1</li>\r\n <li>My Blog Post 2</li>\r\n <li>My Blog Post 3</li>\r\n</ul></small>\r\n<br class=\"space\"><br class=\"space\">\r\n<b>Treepl CMS:</b><br><code>{% component type: \"module\", object: \"item|collection\", collectionVariable: \"my_custom_collection_name\", layout: \"List\", filterBy: \"parentid\", filterValue: \"12345\", source: \"Blog Post\" %}</code><br><small>Notes: No \"rowCount\" equivalent as no longer necessary. Tag filtering can by done via teh \"filterBy\" parameter or via Liquid conditions in the layout or collection.<br>Fully documented Component parameters below.</small></td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-weight: normal;\"><b>BC: Form module</b><br><code>{module_webform id=\"1234\"\"}</code><br><small>eg: <ul>\r\n <li>My Menu Item 1</li>\r\n <li>My Menu Item 2</li>\r\n <li>My Menu Item 3</li>\r\n</ul></small>\r\n<br class=\"space\"><br class=\"space\">\r\n<b>Treepl CMS:</b><br><code>{% component type: \"menu\", alias: \"<menu_alias>\" %}</code><br><small>Fully documented Component parameters below.</small></td>\r\n </tr>\r\n </tbody>\r\n</table> \r\n \r\n \r\n <div class=\"tab-content faqsOpenCloseHolder\">\r\n <div class=\"faqs-open-close \">\r\n <a class=\"opener\" href=\"#\"><i class=\"fas fa-angle-right\"></i>Custom Module Component Documentation</a>\r\n <div class=\"slide js-slide-hidden\">\r\n {% component source: \"Documentation Post\", layout: \"Body Detail\", filterBy: \"id\", filterValue: \"1960\", limit: \"1\", type: \"module\" %}\r\n </div>\r\n </div>\r\n </div>\r\n \r\n <div class=\"tab-content faqsOpenCloseHolder\">\r\n <div class=\"faqs-open-close \">\r\n <a class=\"opener\" href=\"#\"><i class=\"fas fa-angle-right\"></i>Blog Post Component Documentation</a>\r\n <div class=\"slide js-slide-hidden\">\r\n {% component source: \"Documentation Post\", layout: \"Body Detail\", filterBy: \"id\", filterValue: \"2142\", limit: \"1\", type: \"module\" %}\r\n </div>\r\n </div>\r\n </div>\r\n \r\n \r\n <div class=\"tab-content faqsOpenCloseHolder\">\r\n <div class=\"faqs-open-close \">\r\n <a class=\"opener\" href=\"#\"><i class=\"fas fa-angle-right\"></i>Menu Component Documentation</a>\r\n <div class=\"slide js-slide-hidden\">\r\n {% component source: \"Documentation Post\", layout: \"Body Detail\", filterBy: \"id\", filterValue: \"1958\", limit: \"1\", type: \"module\" %}\r\n </div>\r\n </div>\r\n </div>\r\n <p><br><br></p> \r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n<table style=\"width: 100%;\">\r\n <thead>\r\n <tr>\r\n <th><h2 id=\"secSyntax\">Dates, Filters & General Syntax</h2></th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n \r\n <tr>\r\n <td style=\"font-weight: normal;\"><b>BC: Current Date (from server)</b><br><code>{{ globals.site.dateNow | datetime }}</code><br><small>eg: \"09-Jan-2015 02:46 PM\"</small>\r\n <br class=\"space\"><br class=\"space\">\r\n <b>Treepl CMS:</b><br><code>{{ \"now\" | date: \"%d-%b-%Y %I:%M %p\" }}</code><br><small>Date formatting examples in the Liquid documentation <a href=\"https://shopify.github.io/liquid/filters/date/\" target=\"_blank\">here</a>, a very useful tool for generating date formats can be found at <a href=\"http://strftime.net/\" target=\"_blank\">STRFTIME.net</a></small></td>\r\n </tr>\r\n </tbody>\r\n</table> \r\n <div class=\"tab-content faqsOpenCloseHolder\">\r\n <div class=\"faqs-open-close \">\r\n <a class=\"opener\" href=\"#\"><i class=\"fas fa-angle-right\"></i>Liquid Syntax Documentation</a>\r\n <div class=\"slide js-slide-hidden\">\r\n {% component source: \"Documentation Post\", layout: \"Body Detail\", filterBy: \"id\", filterValue: \"2128\", limit: \"1\", type: \"module\" %}\r\n </div>\r\n </div>\r\n </div>\r\n <p><br><br></p>\r\n \r\n ",
"TemplateName": "Docs Template",
"ItemCategories": null,
"ItemCategoryIdList": null,
"ItemTags": [
"Migrations"
],
"SiteSearchKeywords": null,
"ID": 2361,
"CreatedByMemberId": "0",
"IsHome": false,
"Pagination": null,
"OpenGraphProperties": {
"title": null,
"type": null,
"url": null,
"locale": null,
"image": null
},
"Parent": null,
"TemplateVirtualPointer": {
"Pointer": 8491950041332711513,
"TypeId": 1977186194,
"InstanceId": 89,
"DbTypeId": 1977186194,
"DbInstanceId": 89
},
"Params": {}
},
"Type": 5
},
"TemplateVirtualPointer": {
"Pointer": 8491950041332711513,
"TypeId": 1977186194,
"InstanceId": 89,
"DbTypeId": 1977186194,
"DbInstanceId": 89
},
"Params": {}
},
"Type": 5
},
"ReCaptcha_Sitekey": "6Lf2cGcUAAAAABbL4aDrclASNZx9S3uaI9EvpvlI",
"Params": {
"type": "form",
"layout": "",
"alias": "sample_form",
"collectionvariable": "data"
}
}
Field Type Codes
From the data output you can identify the type of field created in the admin via it's Type
property.
The various types are listed below:
- DateTime - 1
- CheckboxList & MailingLists - 2
- DropdownList - 3
- ListboxList - 4
- RadioList - 5
- Multiline - 6
- String - 7
- Boolean - 8
- ReCAPTCHAV2 & ReCAPTCHAV3 - 9
- Upload - 10
- Password - 11
- AcceptPayment - 12
- AcceptEventSubscription - 13
System fields Email, FirstName, LastName, Phone, Site, Address, City, State, ZipCode, Country, Status, Secure Zone Expiry Date, Secure Zone Expiry Duration
all use type 7, and field Notes
uses type 6.
Accessing the Data
JSON Output
You can output the full JSON for your component data by referencing the root Liquid object {{this}}
in your module’s layouts, or directly on your page, if using the collectionVariable
parameter in your component tag.
For example:
{% component type: ... collectionVariable: "myData" %}
You can then render the JSON like so:
{{myData}}
For more details on using this approach, see Part 2 of the free ‘Learning Liquid Course’.
Rendering Property Values
As an alternative, you can instead output the form data directly on the Page or Template via a Liquid Collection if collectionVariable
was added to the Component tag.
An example using collectionVariable
with value "formData" is as follows:
{% component type: "form", alias: "sample_form", collectionVariable: "formData" %}
Looping through the collection to render all the field names:
{% for f in formData.fields %}
{{f['Name']}}<br>
{% endfor %}
Accessing a specific item within the collection. In this case the third fields name (zero based index):
{{formData.fields[2]['Name']}}
Dates, Filters & General Syntax |
---|
BC: Current Date (from server){{ globals.site.dateNow | datetime }} eg: "09-Jan-2015 02:46 PM" Treepl CMS: {{ "now" | date: "%d-%b-%Y %I:%M %p" }} Date formatting examples in the Liquid documentation here, a very useful tool for generating date formats can be found at STRFTIME.net |
Treepl has implemented the full standard Shopify Liquid library. See the External Resources below for relevant links.
Learning Liquid - Free Online Course
If you are new to Liquid, see our free online course to get up to speed: Learning Liquid for Treepl CMS.
Syntax Variations
The default syntax used throughout the system when inserting liquid property tags will use square brackets, single quotes and 'capital camel case' for the property name. See the following example:
{{this['PropertyName']}}
Although, keep in mind that all property names, including custom properties added in Custom Modules, are aliased to a single word all in lowercase (flat case) for the purpose of referencing that data via Liquid.
The 'capital camel case' used above is for readability only as liquid property tags are not case sensitive.
You can choose to use an upper or lowercase syntax here.
Furthermore, as all property names are aliased to a single 'flat case' word, you can optionally use a shorthand method for referencing your property names. Such as the example following:
{{this.PropertyName}} OR {{this.propertyname}}
Notice the removal of the square brackets and single quotes and the addition of the dot (.) separator.
The dot separator is required wherever the square bracket syntax is NOT used.
The square brackets and single quote syntax is part of the liquid syntax for scenarios where property names have spaces included. This is not required in Treepl.
Empty Values (null and nil)
Often scenarios arise where properties will have no value (empty), or are not present in the Liquid output and you may want to check for this condition in your Liquid code.
In Treepl's .NET implementation of Liquid, null
is used as a special value when a value is empty or a property is not present - both conditions will resolve to a null
result. As opposed to the Shopify's Ruby implementation using nil
.
Therefore, a reliable way to check for all empty or not present conditions can be achieved as per the following example, where we are rendering something if the property is NOT equal to (!=
) null
(or an empty value):
{% if this['PropertyName'] != null %}
// Render something here
{% endif %}
For more info on null/nil
and empty values, see the External Resources below for relevant links.
External Resources
Please let us know if you have any other contributions or know of any helpful resources you'd like to see added here.
Questions?
We are always happy to help with any questions you may have.
Visit the Treepl Forum for community support and to search previously asked questions or send us a message at support@treepl.co and we will consult you as soon as possible.