Documentation / Tutorials / Quick Samples

List of Commonly Used Enterprise Shortcodes

/ Quick Samples / List of Commonly Used Enterprise Shortcodes

Shortcode Example Title Description
[modules.called-module-slug x=’passed attribute’/] calling a module This will execute the module in from current active module collection and passed variable ‘x’ will be avilabe using module.x in called module.
[modules.called-module.t1 x=’passed attribute’ /] calling a template This will execute the template t1 from current active module collection and passed variable ‘x’ will be avilabe using template.x in called template.
[modules.called-module template=t1 x=’passed attribute’/] executing a template form module This will execute the template t1 from current active module collection and passed variable ‘x’ will be avilabe using module.x in called template
[modules.include called-module /] Including the module It will not just include the module, without executing it.
[modules.run {module.modulename} x=’passed attribute’/] Modules with dynamic module It runs module without template no template
[modules.run {module.modulename} template='{module.templatename}’ x=’passed attribute’/] Modules with dynamic module and template Run module with template, x will be avaiable in module context.
[modules.run t1 module=called-module x=’passed attribute’/] Run template x will be avilable in template context.
[templates.add hello_dolly]
text
[/templates.add]
adding template You create templates using this shortcode, to access/run this template use
[templates.hello_dolly /]
[module.set a1]
hello dolly[module.get y /][aw2.get request.x /]
[/module.set][module.set y=hello z=hi /]
Set module variable Example of setting a module variable.
[module.set_raw a2]
hello dolly[module.get y /][aw2.get request.x /]
[/module.set_raw]
 Set raw module variable  In case of raw, variables do not get parsed immidiately, but when they are called using one of the follwoing options

[code.run module.a2 /]
[module.a2.run /]

 [template.set y=hello z=hi /]

[template.set a1]
content
[/template.set]

[template.set_raw a2]
raw content
[/template.set_raw]
[template.a2.run /]

 setting template variables  Similar to module variables, you can run a raw template variable using

[template.a2.run /]

[loop.@i module.x]
[aw2.get @i.key /]
[aw2.get @i.item /]
[aw2.get @i.odd /]
[aw2.get @i.even /]
[aw2.get @i.first /]
[aw2.get @i.last /]
[aw2.get @i.between /]
[/loop.@i]
 looping data  Quick example of looping arrays/objects. You can use conditionals like

[if.true i.odd]i am odd:[aw2.get i.item /][/if.true]

 [template.set_array m1 a1=hello a2=hi a3=hope /]  Set template array  It will create an array like this

OutPut:
array(3)
[
“a1” => string(5) “hello”
“a2” => string(2) “hi”
“a3” => string(4) “hope”
]

 [template.dump m1 /]  Dump template variables  Helps you debug/check the value within a template variable.
 [module.set_array x a1=1 a2=2 a3=3 /]
[module.set_array x2 a4=1 a5=2 a6=3 /]
[module.get x merge_with=module.x2 /]
 Merges two arrays  This will merge the values of x with x2, and return teh combined array
[math.solve main='{module.x}*{module.y}’ /]  Using Maths Operations  You can pass the equation string to solve.
[date.create now date_format=’Y-m-d H:i:s’ set=module.dt /]   Show current date  Shows current date formated by string applied to date_format.
 [date.create main=”1st day of ” date_format=’Y-m-d H:i:s’ set=module.dt /]  Creating new dates  You can pass strings supported by strtodate function as well.
[query.get_results set=template.rs]
SELECT * FROM [template.get meta_table /] WHERE meta_key = ‘[template.get meta_key /]’ and meta_value = ‘[template.get meta_value /]’
[/query.get_results]
 Running custom query  You can execute custom queires and get the results.
 [query.query]
delete FROM sub_lan WHERE object_id = ‘[template.get sub_lan_id /]’
[/query.query]
 Custom query  Custom queries that do not give results
[arr.create set=module.arrcreate]
[table]lapp_filter[/table]
[where new column=’req_scheme_id’ value=’xyz’/]
[/arr.create]
 Creating arrays  This will create an array in module.arrcreate variable, with table and where as the key. Also where will have another array as they value with key column and value.
[arr.set module.arrset a={module.x} b={module.x0}/]  Quick Array  This will create an array module.arrset with keys a and b
[template.set_array m3]

[scheme_nbfc default=lotus /]
[scheme_id default=term /]
[scheme_interest_rate default=18 /]
[/template.set_array]

 Using set_array to create array  This will creat a array like

[template.dump m3 /]
OutPut:
array(5)
[
“scheme_nbfc” => array(1)
[
“default” => string(5) “lotus”
]
“scheme_id” => array(1)
[
“default” => string(4) “term”
]
“scheme_interest_rate” => array(1)
[
“default” => string(2) “18”
]
]

[do.search]
hello dolly
[aw2.set search.x=hero /][aw2.set_array search.a x=1 y=2 z=3 /][aw2.get search.x /][aw2.get search.dump /]
[/do.search]
 Using Do  Use this to create a variable to be used locally rather than creating a global variable, within the context of Do. This example will create a serach variable that won’t exists after closing of the tag.
[template.get y /]
[module.get x/] OR
[template.y /]
[module.y /]
 Getting the value of a variable  Assuming variable was set as module.x you can get the value as module.get x
[request.get x /]  Get a request parameter  To get the value of request variable.
 [content.run]
hello [request.get x /]
[/content.run]
 Parse a string immediately  This will run/parse the string within the shortcode.
[php.function_name p1='{module.x}’ set=’module.y’]  calling a PHP function directly You can pass the attributes  using p1, p2 etc.
Categories
Most Popular

Leave a Reply

Your email address will not be published.