Copied to clipboard

Flag this post as spam?

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


  • sg 33 posts 83 karma points
    Jun 05, 2014 @ 20:33
    sg
    0

    PLEASE HELP!! How to get xsl-values from UNPUBLISHED nodes?

    Hi,

    I have a "Contact US" as a Child of "About Us". I don't want to show the "About US" in top navigation. So I am unpublishing the "About US". I have a ContactUS.xslt which reads some properties from the Contact Us page.

    I am trying to do something like this:

    <xsl:for-each select="umbraco.library:GetXmlNodeById(1102)">

    <xsl:value-of select="mailingAddress" disable-output-escaping="yes" />

    </xsl:for-each>

     

    1102 is the Id for "Contact US" node. But since the parent is UNPUBLISHED. it returns an error.

     

    Thanks

    Sg

    That no item with this id is published.

     

    How can i get properties from unpublished nodes?

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 05, 2014 @ 20:45
    Dennis Aaen
    0

    Hi sg,

    So you are using XSLT, the way that you can hide a menu item in your menu, is by add a property on your document type with the alias of umbracoNaviHide the datatype must be true / false, if you use one of the build in XSLT snippets, e.g List subpages from Currentpage. it looks like this:

    <ul>
    <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
        <li>
            <a href="{umbraco.library:NiceUrl(@id)}">
                <xsl:value-of select="@nodeName"/>
            </a>
        </li>
    </xsl:for-each>
    </ul>

    It´s the string(umbracoNaviHide) != '1' that decides if the menu item is visible or hidden. Documentation about umbracoNaviHide can you find here: http://our.umbraco.org/wiki/reference/umbraco-best-practices/umbraconavihide

    Maybe you could share your code, for the top navigation, if you have some code already.

    Hope this helps,

    /Dennis

     

  • sg 33 posts 83 karma points
    Jun 05, 2014 @ 20:56
    sg
    0

    enter image description here

  • sg 33 posts 83 karma points
    Jun 05, 2014 @ 20:58
    sg
    0

    About Us is folder that has no umbraconavihide property

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 05, 2014 @ 21:04
    Dennis Aaen
    0

    Hi sg,

    Okay could you try something like this:

    <xsl:variable name="locationsRoot" select="umbraco.library:GetXmlNodeById(1102)" />
    <xsl:for-each select="$locationsRoot/*[@isDoc and string(umbracoNaviHide)!= '1']">
    <xsl:value-of select="mailingAddress" disable-output-escaping="yes" />
    </xsl:for-each>

    Hope this helps,

    /Dennis

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 05, 2014 @ 21:17
    Dennis Aaen
    100

    And you must have an XSLT file that renders the menu items, on the level commission grants & reporting local plans in there in the for-each loop you need to add the string(umbracoNaviHide)!= '1' as the example above.

    You need to add the umbracoNaviHide for the document type that makes the pages, for commission grants & reporting local plans and so on, and on document type that make the pages recourses and about us. I would say the umbracoNaviHide is alwas nice to have on every document type, so you can hide items, in navgations, therefor I always added it to a master document type.

    Here is a video about working with master documentype http://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/document-types/master-document-type/ and here are the basic about document types. http://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/document-types/ These videos shows it in version 7 but it´s the same if you are usig an older version.

    Hope this helps, and make sense, else keep asking and I will try to help you.

    /Dennis

  • sg 33 posts 83 karma points
    Jun 06, 2014 @ 15:30
    sg
    0

    Thanks Dennis,

    This helped. I was able to get it working using your suggestion!!

    Thanks Shilpi

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 08, 2014 @ 15:43
    Dennis Aaen
    0

    Hi sg,

    Sorry for the late answer, but glad you got it work,

    Could you please mark this a solved. You have a green tick for each post, just click on it for the post with the correct answer.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft