Trying to get images and links to show... won't render
I'm trying to get this to print and it won't let show anything? What's wrong with the code?
#set ($griditems= $_XPathTool.selectNodes($contentRoot, '//gridpopup/griditem'))
#foreach ($gitem in $griditems)
#if ($gitem)
#set ($gimage = $gitem.getChild("gridimage").value)
#set ($glink = $gitem.getChild("griditemlink").value)
#set ($gname = $gitem.getChild("griditemname").value)
<div class="grid-item">
<a class="imglink" href="$glink"><img src="$gimage" alt="$gname"></a>
</div>
#else
<p> </p>
#end
#end
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 Ryan Griffith on 16 Apr, 2014 11:46 AM
Hi,
I have a few questions to see if we can narrow things down a bit:
When you have a moment, also provide the sample XML generated using the Preview Options when editing the Format. Specifically, we'll want to include your page as context so the XML contains the gridpopup nodes.
Please let me know if you have any questions.
Thanks!
2 Posted by msyed1984 on 16 Apr, 2014 02:19 PM
I do have a calling page. Attached is what it renders out.
Here is the generated XML:
And here is the xml preview of the base asset:
3 Posted by Ryan Griffith on 17 Apr, 2014 01:57 PM
Hi,
It looks like you are close, but for the gridimage and griditemlink elements you are attempting to convert an element to a value. Instead, you want to grab the value of the link element.
When you have a moment, try the following and let me know how it works out for you:
Please let me know if you have any questions.
Thanks!
Ryan Griffith closed this discussion on 29 Apr, 2014 04:15 PM.