Login

Recover Your Password

Welcome

Bring Your Vision To Life

We provide software and services that enable our customers and partners to turn advanced technology into real solutions.

What We Do

Contensive works as a team member with client partners, providing the highest level of technical competence and support in the design, production, management & lifecycle support of online applications.

api illustration
API Integration

You name it, we can integrate it

mobile development illustration
Mobile App Development

Custom mobile apps that can do everything

cloud app dev illustration
Cloud Application Development

Customized applications with the features you need

cloud host illustration
Best-In-Class Cloud Hosting

AWS platform, the leader in cloud computing

life cycle illustration
Life Cycle Management

Continuous monitoring, user support, and training

business process illustration
Business Process Automation

Streamline your operations and increase efficiencies

Let’s work on a solution to your problem today!

Process

Agile Software Development Process

Benefits

Why You Should Choose Contensive

The greatest product we offer is our experienced team and our dedication to real-world, time-tested principles: a realistic budget, a disciplined process, and enough flexibility and creativity to accommodate any requirement.

contensive favicon
Proven Development Process

Our agile scrum process allows total transparency

contensive favicon
Time Tested Principles

We follow best practices to get the best results

contensive favicon
Realistic Budget

Payment options that will help you succeed

contensive favicon
Expertise

30+ year history of customer success and profitability

contensive favicon
Talented Team Members

Each developer has disparate skill sets & decades of experience

Experience

Contensive’s Experience

Contensive provides software and services that enable our customers and partners to turn advanced technology into real solutions.

100k+

e-commerce transactions a month

1st

Website allowed in the chamber of US Supreme Court

8 years

Average relationship with client

600+

Websites and applications created

30+

years of experience

300k+

People visiting our applications

Contact Us

Questions?
Call Us (703)-251-0624

Tech Support
support@contensive.com

Return to Product Support > Learning Center > Managing Content > Adding Commands into Content

Adding Commands into Content

Content Commands are strings added directly into the content that are executed when the content is viewed on the website. An example is the command { % user firstname % }which displays the first name of the user.

(Note: in all cases, commands open with "{ %" and close with "% }" except there should be no space between the percent and the close-brace.)

Command Execution

When a command is executed, it loads or modifies its internal Accumulator. When the command is complete, the resulting Accumulator is returned to the page. For instance, the command { % user firstname % } first loads the accumulator with the user's first name. When the end of the command is encountered the entire command string is replaced with the contents of the accumulator.

Shortcut Command Syntax

A simple command has a command and an optional single argument. To execute a simple command, include it in the command block. If the command or its argument includes a space they must be quoted.

  • { % user firstname % } - outputs the users firstname
  • { % "user" "firstname" % } - also valid
  • { % open "/my template.html" % } - opens the file named "my template.html" from the website root folder and outputs it

Full Command Syntax

More complex commands can include multiple arguments and/or have enumerated arguments (arguments that include both a name and a value, like color="blue" and position="top"). In this case, JSON syntax is used to encode the arguments. A command is a JSON object where the command is included either as the first argument or with the argument name "arg".

The general syntax is a single JSON object with one property. The name of the property is the command name and the value of the property is the command's argument(s)

For commands with a single argument use the following syntax.

{ % {"commandName" : "commandArgument" % }

For Commands with multiple arguments use the following.

{ % { "commandName" : { "argName1" : "argValue1", "argName2" : "argValue2" }} % }

For Example:

  • { % {"user":"firstname" } % } - outputs the users firstname
  • { % {"addon" : { "addon":"My Custom Addon","color":"blue" }} % } - runs an addon named "My Custom Addon" with the argument color=blue

Multiple Commands in the same Command Block

Multiple commands can be used in the sample command block "{ % % }". The first commands loads the accumulator and each subsequent command modifies it. Use JSON array syntax to hold multiple commands.

The following command first loads the users firstname, then does and find-and-replace, changing lower case "a" to lower case "b"

{ % [ { "user" : "firstname" } , {"set" : { "find":"a","replace":"b"}} ] % }

Commands

textBox

Opens a record from Copy Content. If editing is enabled, content managers get an edit icon for this copy.

{ % textbox "home page footer" % }

{ % {"textbox" : { "name":"home page footer" }} % }

openCopy

Opens a record from Copy Content without editing support.

{ % opencopy "home page footer" % }

{ % {"opencopy" : { "name":"home page footer" }} % }

openLayout

Opens a record from Layouts.

{ % openLayout "Organization List Item" % }

open

Opens a file in the website root path.

{ % open "/homeTemplate.html" % }

import

Opens a file in the website root path and includes its head elements in the current page.

{ % import "/homeTemplate.html" % }

user

Opens a field from the current user's record.

{ % user firstname % }

{ % { "user" : { "field":"firstname" }} % }

site

Opens a site property.

{ % site "Caption for My Form" % }

{ % { "site" : { "name":"Caption for My Form" }} % }

set

Performs a find and replace on the current accumulator.

{ %  {"set" : { "find":"good","replace":"great" }} % }

getInner

Find and returns the string in the accumulator based on a style selector in the find argument.The innerHtml is everything inside the start and end tag.

For the following html:

{ % {"getInner" : { "find":".main-nav" }} % }

returns the innerHtml of all elements with the class "main-nav", in this case it returns: "this is the text in the middle"

setInner

Performs a find and replace on the current accumulator, where the find argument is a style selector and when it is found, the inner Html of that elements is replaced by the value of the replace argument. The replace argument can be another JSON command like "open" or "getInner"

{ % {"setInner" { "find":".left-nav","replace":"Left Navigation" }} % } - replaces the innerHtml of all elements with class "left-nav" with the text "Left Navigation"

{ % {"setInner" : { find":".footer-nav" , "replace": {"menu" : "Footer Menu" }}} % } - replaces the innerHtml of all elements with class "footer-nav" with the output of theMenu add-on run with the argument name="Footer Menu"

getOuter

Find and returns the string in the accumulator based on a style selector in the find argument.

{ % {"getOuter" : { "find":".main-nav" }} % } - returns the outerHtml of all elements with the class "main-nav". The outerHtml is everything inside the tag, plus the opening and closing tag.

setOuter

Performs a find and replace on the current accumulator, where the find argument is a style selector and when it is found, the outer Html of that elements is replaced by the value of the replace argument. The replace argument can be another JSON command like "open" or "getOuter". The outerHtml is everything inside the tag, plus the opening and closing tag.

{ % {"setInner" { "find":".left-nav","replace":"Left Navigation" }} % } - replaces the innerHtml of all elements with class "left-nav" with the text "Left Navigation"

{ % {"setInner" : { find":".footer-nav" , "replace": {"menu" : "Footer Menu" }}} % } - replaces the innerHtml of all elements with class "footer-nav" with the output of theMenu add-on run with the argument name="Footer Menu"

addon

Execute an addon and replaces the accumulator with the results. The command is "addon" and it has two arguments, the addon name and the addon's arguments.

{ % {"My Custom Addon" : { "color":"blue" }} % } - runs an addon named "My Custom Addon" with the argument color=blue

An example with multiple arguments. This creates a page extension named Lydia that changes for each section.

{ % { "page extension" : { "extensionname":"Lydia", "extensiontype" : "section"}}%}

All Others

Attempt to locate an addon with the name matching the command