Trying to get a format to work

Fernando's Avatar

Fernando

16 Aug, 2016 08:44 PM

I am trying to turn on and off this image that shows up on my homepage slideshow. So I created a if statement when the user hits yes ($umsldailyYesN) you can add and image to it

but for some reason I cant get it to work right. It assumes it is turned on all the time. Could you take a look at it and see what you think?

Thanks!

  1. 1 Posted by Bradley Wagner on 19 Aug, 2016 01:45 PM

    Bradley Wagner's Avatar

    Hi Fernando,

    I noticed in your format that you're attempting to check this here:

    #set($umsldailyYesNo = $_XPathTool.selectSingleNode($contentRoot, "//system-data-structure/slide/umsldaily1").value)            
    #if($umsldailyYesNo == "Yes")
    ...
    #else
    ...
    #end
    

    I think what might be happening is that you're effectively checking the same selectSingleNode in every iteration of your loop. You need to scope your XPath there to either use your current slide as the context or to specifically access that umsldaily1 node by name as you're doing above for this other field:

    #set($link = $_EscapeTool.xml($slide.getChild("symlink").getChild("content").getChild("system-symlink").value))
    

    Currently, you're checking the same value for the first slide over and over again.

    Let me know if that makes sense.

    Thanks!

Comments are closed, but you can 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