Passing infromation between regions / index blocks...

Chris's Avatar

Chris

09 Apr, 2015 03:42 PM

I am trying to figure out a way to structure (limit) my end-user's creativity whilst editing the website.

I am using a "Current Page" index block to gather all of the options the user can select/deselect using the Data Definition for the given page. That covers Region A. I am using a different index block in Region B for the navigation.

The problem I am running into is when it comes to passing information from one region to another. If Region A (Current Page Index Block) says: no navigation. How do I get Region B to adhere to that?

One way this could be done is allowing the user to select the navigation's index block in the Data Definition with a selector. Then all of the formatting could be done within the same index block.

Is this my only option?

  1. 1 Posted by Ryan Griffith on 10 Apr, 2015 01:25 PM

    Ryan Griffith's Avatar

    Hi Chris,

    You could accomplish this in one of two ways:

    • Include the calling page information with your navigation Index Block, so your navigation Format has access to both calling page data and the indexed content
    • Use a standalone Velocity Format and utilize the $currentPage variable, which will give you access to a Page API object for the calling page.

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by Chris on 15 Apr, 2015 02:43 PM

    Chris's Avatar

    Awesome, thank you Mr. Griffith!

    Took me a little while to figure out where the $currentpage started looking through the XML, and then to get the values of a checkbox into an array, but I have it working great now!

    Reference Page Index Block Region A

    <system-data-structure definition-path="Default">
     <options>
      <value>Banner</value>
      <value>Sidebar</value>
     </options>
    </system-data-structure>
    

    Velocity Region B

    #set ($pageOptions = $currentPage.getStructuredDataNode("options").textValues)
    
    #if ($pageOptions.size() > 0 )
     #foreach ( $option in $pageOptions )
      ...
     #end
    #end
    
  3. Chris closed this discussion on 15 Apr, 2015 02:43 PM.

Discussions are closed to public comments.
If you need help with Cascade CMS please start a new discussion.

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

 

26 Aug, 2016 01:19 PM
25 Aug, 2016 03:02 PM
25 Aug, 2016 12:50 PM
24 Aug, 2016 08:43 PM
24 Aug, 2016 07:20 PM
21 Aug, 2016 01:20 PM