setDynamicContent
A Mura Scope helper method to render Mura [m] tags. This function checks a string for Mura [m] tags, and if found, will pass the variable or function call the the CFML server for processing before final rendering of the page.
Function Syntax
m.setDynamicContent( string )
Parameters
Parameter | Type | Req/Opt | Default | Description |
---|---|---|---|---|
string | string | Opt | empty string |
This is the string to parse for Mura [m] tags. |
Usage
Use this function to search through a string for Mura [m] tags. Most use cases revolve around user-entered text that may, or may not, contain Mura [m] tags, such as the "Summary" field of a content item.
Examples
You can wrap this method around any string, or anticipated string, to render Mura [m] tags.
Basic Example
The following is a very basic example to illustrate how to output an explicit string containing Mura [m] tags.
<cfset exampleString = "Today is [m]DateFormat(Now(), 'yyyy-mm-dd')[/m]" /> <cfoutput> <div> #m.setDynamicContent(exampleString)# </div> </cfoutput>
Content Summary
The following example illustrates how to output a content item's "Summary" field, if you expect it may contain Mura [m] tags. You could apply this method to nearly any text field of a content item.
<cfoutput> <article> #m.setDynamicContent(m.content('summary'))# </article> </cfoutput>