Format returning nothing

Joel Trauger's Avatar

Joel Trauger

21 Aug, 2014 02:05 PM

I have this block sds.txt generated by entering values with a Data Definition. There are three fields as outlined in the following XML:

<system-data-structure>
    <group identifier="link" label="Link" multiple="true">
        <text identifier="linktitle" label="Link Title" required="true"/>
        <asset type="page,file,symlink" identifier="ilink" label="Internal Link" help-text="If this is used, it will take precedence over the external link"/>
        <text identifier="elink" label="External Link" default="http://" help-text="If this is used, make sure the Internal Link is blank."/>
    </group>
</system-data-structure>

The file sdaformat.txt contains the format I am using to pull each item and place it in a list as a menu.

Whenever I tested the format, yesterday, it would return an error. I have attached my cascade.log file from yesterday as well. Today, however, the format only returns the initial <li> blahblahblah </li> and nothing after that. I have a counter set up as debugging and the counter is not being incremented, so I know the foreach loop is not even executing.

What am I doing wrong?

  1. 1 Posted by Ryan Griffith on 21 Aug, 2014 05:58 PM

    Ryan Griffith's Avatar

    Hi Joel,

    It looks as though you may need to tweak the XPath used to obtain the $links variable as well as the way you are accessing the path of the ilink page.

    When you have a moment, give the following a try and let me know how it works out:

    #set ( $links = $_XPathTool.selectNodes($contentRoot, "/system-data-structure/link") )
    <li style="list-style: none"></li>
    #set ( $count = 0 )
    #foreach ( $link in $links )
        #if ( $link.getChild("ilink").getChild("path").value == "/" )
            #set ( $linkpath = $link.getChild("elink").value )
        #else
            #set ( $linkpath = $link.getChild("ilink").getChild("path").value + ".html" )
        #end
        #set ( $linktitle = $link.getChild("linktitle").value )
        #if ( $count > 0 )
            <li style="list-style: none">
                <hr style="padding:0; margin:0;"/>
            </li>
        #end
        #set ($count = $_MathTool.add($count, 1))
        <li style="link-style: none">
            <a href="${linkpath}">${linktitle}</a>
        </li>
    #end
    

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by Joel Trauger on 22 Aug, 2014 02:45 PM

    Joel Trauger's Avatar

    This worked great, thanks! I see now the errors I was making. Small ones, but they add up fast. Come check out our new homepage next week! Powered 100% by Cascade Server!

  3. 3 Posted by Ryan Griffith on 22 Aug, 2014 02:46 PM

    Ryan Griffith's Avatar

    Thank you for following up, Joel. I am glad to hear the changes helped out.

    I'll be sure to check out your site next week, congrats!

    I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open if you have any additional questions.

    Have a great day!

  4. Ryan Griffith closed this discussion on 22 Aug, 2014 02:46 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