apply system-region data to a coldfusion tag

Jason's Avatar

Jason

25 Jun, 2010 02:54 PM

Is there any way to output the value of a system-region tag into a coldfusion variable. such as

<cfset a = '<system-region name="MENU"/>'>

or in my case

<cf_template menu='<system-region name="MENU"/>'>
  1. Support Staff 1 Posted by Tim on 25 Jun, 2010 05:08 PM

    Tim's Avatar

    Hi Jason,

    Is there a specific reason you are looking to do this? If you need to surround the content (of what will eventually be placed in this region) with CF tags, I would suggest doing so with the use of an XSLT or Velocity Format plugged into this region.

  2. 2 Posted by Jason on 25 Jun, 2010 05:54 PM

    Jason's Avatar

    On our live site we use a custom coldfusion tag called cf_template which wraps the body content in a specified template.

    <cf_template type="Main" Menu="Yes"> body data </cf_template>
    

    It has two options "type" which is how you select which template to use and "menu" which is typically a yes or no. In cascade I have created a template that uses the cf_template and wraps the <system-region name="DEFAULT"/> tag and works perfectly. The <system-region name="MENU"/> tag has a index block attached which tells whether or not the user selected the "show in side bar" option. So, what I want to do is put the information from the <systen-region name="MENU"/> tag into the cf_template tag.

    
    <cf_template type="Main" menu='insert data from <system-region name="MENU'/> here ">
    
  3. Support Staff 3 Posted by Tim on 25 Jun, 2010 06:01 PM

    Tim's Avatar

    Ok, so what you will want to do is keep the <system-region name="MENU"/> tag in your Template, then attach your menu Index Block to that region along with an XSLT/Velocity Format which transforms the content of the Index Block and outputs the <cf_template> tag with the appropriate information inside of it.

    Does this make sense?

  4. 4 Posted by Jason on 25 Jun, 2010 06:43 PM

    Jason's Avatar

    Let me ask you about another problem we are having.
    when i put the <system-region name="MENU"/> in <cf_template> and click submit this

    
    <cf_template type="Main" menu='<system-region name="MENU"/>'>
    <system-region name="DEFAULT"/>
    </cf_template>
    

    turns into this

    <system-xml><system-region name="DEFAULT"/></system-xml>
    

    To fix this I have to use &lt;system-region name="MENU"/> instead of <system-region name="MENU"/> Which has not worked maybe because I didn't have the XSLT/Velocity Format attached. So, is there a better way to do this?

  5. Support Staff 5 Posted by Tim on 25 Jun, 2010 06:55 PM

    Tim's Avatar

    This is likely happening because those tags are not valid XHTML. You won't be able to have <system-region> tags inside the attribute of another tag because the system performs an XML parse as opposed to a string replace.

  6. Tim closed this discussion on 08 Jul, 2010 02:20 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac