create an unclosed XHTML block?

James's Avatar

James

30 Sep, 2010 01:26 PM

Is it possible to have an XHTML block that has code something like this:

<div id="menu">
<ul id="nav">

and then have a separate block that begins with

</ul>
</div>

with the idea being that I would want to create some sort of editable nav between the 2 blocks (How?)?

Showing page 2 out of 2. View the first page

  1. 31 Posted by Jamie johnson on 15 Dec, 2010 02:23 PM

    Jamie johnson's Avatar

    I have some XML like this:

    <system-index-block name="side nav index" type="folder"
    current-time="1292422623327">
    ...
    <system-symlink id="ea5f621b867e488e01664cde36cdcba8">
    <name>t--c</name>
    <title>T & C</title>
    <path>/_nav/side/t--c</path>
    <site>computing</site>
    <dynamic-metadata>
    <name>type</name>
    <value>Link</value>
    </dynamic-metadata>
    <link>/</link>
    ...
    </system-symlink>
    </system-index-block>

    I also have a format using Velocity Script.

    When I do this:

    $node.getChild("name").text

    I get the name t--c just fine.

    However, when I do this:

    $node.getChild("title").text

    I have no such luck.

    I've also tried the following without success:

    $node.getChild("title").text()
    $node.title.text()
    $node.getChild("title").value

    Any suggestions?

    James "Jamie <http://people.jmu.edu/johns2ja>" Johnson, BBA, MA, A+
    <http://certification.comptia.org/a/>, ACHDS
    <http://train.apple.com/certification/achds.html>, HDA
    <http://www.thinkhdi.com/certification/individualCertification/HDABootcamp.aspx>,
    HDM
    <http://www.thinkhdi.com/certification/individualCertification/hdm.aspx>, MOS
    <http://www.microsoft.com/learning/mcp/officespecialist/default.mspx>,
    W3S/HTML <http://www.w3schools.com/cert/cert_html.asp>
    JMU Information Technology Web Developer
    Browser Detection and Test
    <http://isapps.jmu.edu/tutorials/browser/BrowserDetection.asp>

    /"Test everything. Hold on to the good."/
    1 Thessalonians 5:21
    <http://www.biblegateway.com/passage/?search=1%20Thessalonians%205:21&version=NIV>

  2. 32 Posted by Penny on 15 Dec, 2010 02:28 PM

    Penny's Avatar

    I think your issue is the & in your title. Any time there is a chance of an & being in your content you will need to use the SerializerTool. This will convert your & into &amp;. That being said, you should serialize anytime your content is user entered into a text/wysiwyg field.

    Try the following:

    $_SerializerTool.serializer($node.getChild("title"), true)
    
  3. 33 Posted by Jamie johnson on 15 Dec, 2010 02:48 PM

    Jamie johnson's Avatar

    I failed to mention that we attempted to use the Serializer Tool as well
    and that did not work, either.

    We get a rendering of the actual code, not a value.

    James "Jamie <http://people.jmu.edu/johns2ja>" Johnson, BBA, MA, A+
    <http://certification.comptia.org/a/>, ACHDS
    <http://train.apple.com/certification/achds.html>, HDA
    <http://www.thinkhdi.com/certification/individualCertification/HDABootcamp.aspx>,
    HDM
    <http://www.thinkhdi.com/certification/individualCertification/hdm.aspx>, MOS
    <http://www.microsoft.com/learning/mcp/officespecialist/default.mspx>,
    W3S/HTML <http://www.w3schools.com/cert/cert_html.asp>
    JMU Information Technology Web Developer
    Browser Detection and Test
    <http://isapps.jmu.edu/tutorials/browser/BrowserDetection.asp>

    /"Test everything. Hold on to the good."/
    1 Thessalonians 5:21
    <http://www.biblegateway.com/passage/?search=1%20Thessalonians%205:21&version=NIV>

  4. 34 Posted by Jamie johnson on 15 Dec, 2010 02:56 PM

    Jamie johnson's Avatar

    Penny,

    We tried the following:

    $_SerializerTool.serialize($node.getChild("title"), true)

    (using .serialize instead of .serializer)

    However, we had tried this exact code (.serialize) last evening and this
    morning and it did not work. After a delay, it appears to be working
    now after banging our heads against the wall for a couple of hours.

    Thanks for your help.

    James "Jamie <http://people.jmu.edu/johns2ja>" Johnson, BBA, MA, A+
    <http://certification.comptia.org/a/>, ACHDS
    <http://train.apple.com/certification/achds.html>, HDA
    <http://www.thinkhdi.com/certification/individualCertification/HDABootcamp.aspx>,
    HDM
    <http://www.thinkhdi.com/certification/individualCertification/hdm.aspx>, MOS
    <http://www.microsoft.com/learning/mcp/officespecialist/default.mspx>,
    W3S/HTML <http://www.w3schools.com/cert/cert_html.asp>
    JMU Information Technology Web Developer
    Browser Detection and Test
    <http://isapps.jmu.edu/tutorials/browser/BrowserDetection.asp>

    /"Test everything. Hold on to the good."/
    1 Thessalonians 5:21
    <http://www.biblegateway.com/passage/?search=1%20Thessalonians%205:21&version=NIV>

  5. 35 Posted by Penny on 15 Dec, 2010 02:57 PM

    Penny's Avatar

    Hey Jamie,

    Interesting. Can you include the entire contents of the Velocity script?

    The following should work:

    #set ($nodes = $_XPathTool.selectNodes($contentRoot, "/system-index-block/system-symlink | /system-index-block/system-folder  | /system-index-block/system-page"))
    #foreach ($node in $nodes)
        $_SerializerTool.serialize($node.getChild("title"), true)
    #end
    
  6. 36 Posted by Jamie johnson on 15 Dec, 2010 03:01 PM

    Jamie johnson's Avatar

    It's working now, but here's the script:

    #macro(parse_node $node)
         #if($node.name == "system-folder")
    <li class="yuimenuitem" onmouseover="JMUSlideshowBG()">
    <a class="yuimenuitemlabel"
    href="#$node.getChild("name").text.toLowerCase()">$node.getChild("name").text</a>
    <div id="$node.getChild("name").text.toLowerCase()" class="yuimenu">
    <div class="bd">
    <ul>
             #foreach ($subnode in
    $_XPathTool.selectNodes($node,"system-folder | system-symlink"))
                 #parse_node($subnode)
             #end
    </ul>
    </div>
    </div>
    </li>
         #elseif($node.name == "system-symlink")
             #set ($type =
    $_XPathTool.selectSingleNode($node,"dynamic-metadata[name =
    'type']/value").text.toLowerCase())
             #if($type == "divider")
    <li class="yuimenuitem $type"> </li>
             #elseif($type == "heading")
    <li class="yuimenuitem
    $type">$_SerializerTool.serialize($node.getChild("title"),true)</li>
             #elseif($type == "link" || $type == "bulleted_link")
    <li class="yuimenuitem $type"><a class="yuimenuitemlabel"
    href="$node.getChild("link").text">$_SerializerTool.serialize($node.getChild("title"),true)</a></li>
             #else
    <li class="yuimenuitem" title="$type"><em>unknown type</em></li>
             #end
         #end
    #end

    <script language="JavaScript" type="text/JavaScript">
    // johns2ja 10 December 2010
    function JMUSlideshowBG() {
         document.getElementById('JMUCoreSlideshow').style.zIndex=0;
    }
    </script>

    <div class="yuimenu" id="jmuyuipopout">
    <!-- johns2ja added onmouseover="JMUSlideshowBG()" to this menu to
    parent li -->
    <div class="bd">
    <ul class="first-of-type" id="vertNav">
    #foreach($node in
    $_XPathTool.selectNodes($contentRoot,"/system-index-block/system-folder
    | /system-index-block/system-symlink"))
         #parse_node($node)
    #end
    </ul>
    </div>
    </div>

    James "Jamie <http://people.jmu.edu/johns2ja>" Johnson, BBA, MA, A+
    <http://certification.comptia.org/a/>, ACHDS
    <http://train.apple.com/certification/achds.html>, HDA
    <http://www.thinkhdi.com/certification/individualCertification/HDABootcamp.aspx>,
    HDM
    <http://www.thinkhdi.com/certification/individualCertification/hdm.aspx>, MOS
    <http://www.microsoft.com/learning/mcp/officespecialist/default.mspx>,
    W3S/HTML <http://www.w3schools.com/cert/cert_html.asp>
    JMU Information Technology Web Developer
    Browser Detection and Test
    <http://isapps.jmu.edu/tutorials/browser/BrowserDetection.asp>

    /"Test everything. Hold on to the good."/
    1 Thessalonians 5:21
    <http://www.biblegateway.com/passage/?search=1%20Thessalonians%205:21&version=NIV>

  7. 37 Posted by Penny on 15 Dec, 2010 03:03 PM

    Penny's Avatar

    Well, I am glad to hear it is working. Generally, if it outputs the line not evaluated, the variable you are trying to operate on has a null value.

    It might have been a syntax error. You can always check your Versions tab and see what the issue is. This sometimes happens to me when I forget the $ sign or misspell the variable name.

    Glad to hear it is working. Can we now close this issue and have you start new ones so that others can benefit by being able to search shorter threads from the issue that you have?

  8. 38 Posted by Jamie johnson on 15 Dec, 2010 03:04 PM

    Jamie johnson's Avatar
  9. Tim closed this discussion on 15 Dec, 2010 09:13 PM.

  10. Jamie johnson re-opened this discussion on 20 Dec, 2010 07:09 PM

  11. 39 Posted by Jamie johnson on 20 Dec, 2010 07:09 PM

    Jamie johnson's Avatar

    Greetings,

    We are trying to do an &nbsp; in a velocity script, but it says the
    entity is an undefined function. We attempted using the Serializer Tool
    with just a space as the parameter and it throws an exception; i.e., it
    didn't work. We thought we could declare a variable and assign it the
    value of " " and go from there, but we haven't had success. Any suggestions?

    James "Jamie <http://people.jmu.edu/johns2ja>" Johnson, BBA, MA, A+
    <http://certification.comptia.org/a/>, ACHDS
    <http://train.apple.com/certification/achds.html>, HDA
    <http://www.thinkhdi.com/certification/individualCertification/HDABootcamp.aspx>,
    HDM
    <http://www.thinkhdi.com/certification/individualCertification/hdm.aspx>, MOS
    <http://www.microsoft.com/learning/mcp/officespecialist/default.mspx>,
    W3S/HTML <http://www.w3schools.com/cert/cert_html.asp>
    JMU Information Technology Web Developer
    Browser Detection and Test
    <http://isapps.jmu.edu/tutorials/browser/BrowserDetection.asp>

    /"Test everything. Hold on to the good."/
    1 Thessalonians 5:21
    <http://www.biblegateway.com/passage/?search=1%20Thessalonians%205:21&version=NIV>

  12. 40 Posted by Penny on 20 Dec, 2010 07:17 PM

    Penny's Avatar

    Hey Jamie,

    I don't want to give you the run around but we really need you to create a new issue for this and it should go under the topic Velocity Formats. I am asking this because I feel like it may be an issue others have and under the current topic and heading, I do not think anyone will see it by using the search.

  13. Penny closed this discussion on 20 Dec, 2010 07:17 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