Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Robin Nicholl 137 posts 277 karma points
    Dec 28, 2010 @ 15:26
    Robin Nicholl
    0

    Get field of specific node

    I want to be able to access/render a field of a specific node. Each child, grandchild etc of the homepage will have a 'Menu' field which will be used to populate a drop-down menu that will be available on every page. So, within an XSLT that'll be referenced from the template for every page there would be something like:

    <xsl:value-of select="Menu-field-of-page-named-Events" />

    The pages in which the macro for this XSLT will sit could be the homepage itself, one of its children or grandchildren.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 28, 2010 @ 15:36
    Jan Skovgaard
    0

    Hi Robin

    If I understand your question correctly you want to be able to show events on different pages?

    If so this sounds like you could benefit from placing a content picker on your nodes. In that way you can pick the root of your events node and pass the value of that property to your XSLT and fetch the nodes by using for instance umbraco.library:GetXmlNodeById(). In here you'll pass the value of the content picker (which holds the id of the selected page) like this: umbraco.library:GetXmlNodeById($currentPage/yourcontentpickerpropertyname).

    I hope the above makes sense to you? :-)

    /Jan

  • Robin Nicholl 137 posts 277 karma points
    Dec 28, 2010 @ 15:47
    Robin Nicholl
    0

    No. I have a main navigation displaying each of the main content sections/pages. When you roll over one of these a drop-down panel appears. I want to display some content on this panel that belongs to the relevant page. For example, the Events page has a 'Menu' tab that contains a 'Content' field. Whichever page the user is on, when they roll over the Events item in the menu I want the drop-down to display the Content field from the Menu tab of the Events page.

    Basically, I want to be able to access a field of a specific page from any page or sub page.

    I am new to this.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 28, 2010 @ 16:09
    Jan Skovgaard
    0

    Hi Robin

    Do I get this correct. What you're trying to do is make a mega dropdown menu like this http://www.sohtanaka.com/web-design/examples/mega-dropdowns/ but instead of nesting the other levels of navigation within it you want some text, which describes what is to be found in the section? Correct?

    /Jan

  • Robin Nicholl 137 posts 277 karma points
    Dec 28, 2010 @ 16:14
    Robin Nicholl
    0

    Hi Jan

    Yes, that's it. The drop-downs for most sections will contain dynamic content, but some of them need to contain content defined by the client. This will be input in a field in the Menu tab of the relevant page. So, the drop-down content for the Events page will reside in the 'Content' field of the 'Menu' tab of the Events page. I therefore need to be able to access this field from wherever I am in the site.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Dec 28, 2010 @ 19:59
    Tom Fulton
    0

    Hi Robin,

    If you know the ID of the node you can use umbraco.library:GetXmlNodeById(id) to get the XML for that node.

    Assuming you already have a for-each loop to write out your navigation items, you could put something like this in your for-each loop:

    <xsl:value-of select="umbraco.library:GetXmlNodeById(@id)/yourFieldAlias"/>

    Or if you need to get several fields you can assign to a variable, ie

    <xsl:variable name="myNode" select="umbraco.library:GetXmlNodeById(@id)"/>
    <xsl:value-of select="$myNode/yourFieldAlias"/>

    -Tom

  • Robin Nicholl 137 posts 277 karma points
    Dec 28, 2010 @ 21:02
    Robin Nicholl
    0
    <xsl:value-of select="THANK-YOU" />
Please Sign in or register to post replies

Write your reply to:

Draft