Dynamic content refers to website content that isn't fixed or static, but changes based on user action. Use dynamic content on your website to display data from third-party services without updating the website every single time.
For example, you can integrate two different applications such as Zoho Sites and Zoho Creator to display dynamic content on your website.
Steps to Insert Dynamic Content into your website
Click the + icon at the top-left corner of your website builder.
Click App from the dropdown.
Select Dynamic Content from the options.
Drag and drop Dynamic Content to the location where you'd like it to be displayed.
Click Edit. You will be taken to the Dynamic Content Listing page where you can select the appropriate dynamic content
Click the relevant dynamic content to edit the existing code or write a custom one. You can edit views, functions and sytlesheets.
HTML
CSS
JavaScript
Deluge Script - Zoho's scripting language that links over 25 Zoho Apps
Face - A language for templates designed for Zoho Sites
The four components of Dynamic Content
FUNCTIONS
Here's a function named "fetchPartners" that fetches records stored in Zoho Creator:
//START
records = zoho.creator.getRecords("David","partners","Partner_View");
return records;
//END
Explanation:
criteria = "ID==".concat(id);
records = zoho.creator.getRecords("David", "partners", "Partner_View", criteria);
record = records.get(0);
return record;
//END
VIEWS
Every instance of Dynamic Content has a main view file, and it loads the view available.

View: main
{% partners = functions.execute("fetchPartners") %}
<div>
<center><h3>Partners</h3></center>
</div>
<div dc-container="partner-area">
{% for partner in partners %}
<div>
<h2 style="cursor: pointer" dc-param-id="{{ partner.ID }}" dc-bind-click="true" dc-view="partner" dc-target="partner-area">
{{ partner.name }}
</h2>
<p>{{ partner.email }}</p>
</div>
{% endfor %}
</div>
Explanation:
Attribute | Description |
dc-container | Defines a container to load a DC view, value should be alphanumeric and unique. |
dc-bind-click | Binds click event for the HTML element, value should be either "true" or a name of callback function. |
dc-view | Defines the DC view name when the HTML element is clicked. Required when dc-bind-click = "true". |
dc-target | Defines the container where the DC view defined in dc-view will be loaded. Value should be one of dc-container. |
dc-param-<param-name-placeholder> | Defines parameters that need to be sent to DC view. There can be multiple use, all such dc-param attributes are sent to DC view. eg. dc-param-pid="123" can be accessed in DC view with request_object.parameters.pid |
View: partner
{% partner_id = request_object.parameters.id %}
{% partner_details = functions.execute("fetchPartnerDetails", partner_id) %}
<div>
<h2>{{ partner_details.name }}</h2>
<p>{{ partner_details.phone }}</p>
<img alt="{{ partner_details.name }}" src="{{ partner_details.image }}" />
<div style="cursor: pointer" dc-view="main" dc-target="partner-area">
back
</div>
</div>
Explanation:
DC View function
{% records = functions.execute("fetchPartners") %}
Example:
{% records = functions.execute("fetchPartners",param1,param2, ..) %}
Below are the objects and functions available in a Dynamic Content view.

Property | Description |
display_name | Name of the logged-in user |
email_address | Email address of the logged-in user |
groups | Display name list of portal group the user belong |
Example:
{% if user %}
{"display_name":"{{ user.display_name }}","email_address":"{{ user.email_address }}"}
{% endif %}
Object: request_object
Request based on request_object values will not work if cache is enabled for the view.Property | Description |
domain_name | Domain part of request |
uri | URI path of the request |
parameters | Collection of parameters |
headers | Collection of request headers |
cookies | Collection of cookied |
Example:
{% partner_id = request_object.parameters.id %}
This is used to invoke functions in dynamic content.
Example:
{% assign variable_name = functions.execute("dc_function_name", param1, param2, ...) %}
{% response_object.setStatus(status_code) %}
{% response_object.setCookie(cookie_name, cookie_value, path, max_age) %}
JAVASCRIPT
The following are the API methods available for JavaScript.
Method | Description |
$DX.get | Sends HTTP GET request to DC view. Takes Request Object as an argument, please refer table below. |
$DX.post | Sends HTTP POST request to DC view. Takes Request Object as an argument, please refer table below. |
Property | Description |
url | url of the view |
params | Parameters to be sent to view as JSON object |
handler | On successful response, this callback function will be called with XMLHttpRequest as "this" reference. |
headers | collection of request headers |
args | Arguments to be sent to handler as JSON object |
Here is an example of main.js overriding the "init" function and handling view loading itself
define( function() {
function showPartner(options){
$DX.get({
url: "/dcapp/" + options.dc_name + "/partner",
params : options.params,
handler: function (){
options.target.innerHTML = this.responseText
}
}
);
}
function init(context, params){
var dc_name = context.getAttribute('data-dc-name');
//the attribute data-dc-name of the root DC element has the DC name
var dc_home_page = context.getAttribute('data-home-page') ||
'main';
//the attribute data-dc-name has the default view name
$DX.get({
url: "/dcapp/" + dc_name + "/" + dc_home_page ,// No I18N
handler: function (){
context.innerHTML = this.responseText
}
}
);
}
return {
showPartner : showPartner,
init : init
}
})
$DX.get({
url: "/dcapp/" + <dc_name> + "/function/" + <dc_function_name >,
handler: function (){
//code to handle function get
}Fetching form data from Zoho Sites
Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.
If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.
All-in-one knowledge management and training platform for your employees and customers.
You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.