Use current page data definition fields inside a block.
I currently have a block "header", which contains a title.
Also I have a page with a data definition that defines such title.
how can I access the current page data definition while im inside the header block?
I have tried the following:
#set( $content = $_XPathTool.selectSingleNode($contentRoot, "/system-data-structure"))
#set( $content = $_XPathTool.selectSingleNode($contentRoot, "/system-folder[system-page[@current]]"))
but it seems I can only access the data definition for the block.
is it possible or I am doing thigs wrong?
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
1 Posted by Wing Ming Chan on 12 May, 2016 04:04 PM
First, is the header block attached to the page in question? If not, how are the two related? If so, is the block attached to a region or a block chooser?
Wing
2 Posted by latorresescobed... on 12 May, 2016 04:05 PM
yes the block is attached to the page in question. and the block belongs to a region.
3 Posted by Wing Ming Chan on 12 May, 2016 04:15 PM
Since the block is attached to a region, you loss the context of the hosting page. If you look at $contentRoot, it only contains the XML of the block, not anything related to the hosting page. You will have to use the
$currentPage
variable to retrieve page content, utilizing the Cascade API. Another option is to attach the block to a block chooser in the page instead. Then you will have to process the block while you are processing the page. The context of the page is given.Wing
4 Posted by latorresescobed... on 12 May, 2016 04:30 PM
this did the trick, thank you.
Ryan Griffith closed this discussion on 12 May, 2016 05:35 PM.