Copied to clipboard

Flag this post as spam?

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


  • Bjarne Fyrstenborg 1284 posts 4038 karma points MVP 8x c-trib
    Jun 17, 2012 @ 17:49
    Bjarne Fyrstenborg
    0

    Problem with ignoreDocumentTypes parameter

    Hi..

    I have noticed a small problem with the ignoreDocumentTypes parameter in the navigation fra the starterkit.

    I have inserted the macro with these parameters:

    <umbraco:Macro fromLevel="3" numberOfLevels="4" showOnlyCurrentPath="0" isSitemap="0" navigationId="topnav" rootPage="" ignoreDocumentTypes="Error404, Quote, uBlogsyContainerBlog, uBlogsyContainerEmailTemplate" imageProperty="" sort="" useSelfAsRoot="0" Alias="Navigation" runat="server"></umbraco:Macr

    I have installed uBlogsy to have a blog on the website which have some documenttypes uBlogsyContainerPage and uBlogsyPage.. in the original site I have a document type Page for each standard text page.

    So I want the exclude these uBlogsyContainerPage and uBlogsyPage from navigation, but when I do this, they also hide Page documenttype pages from navigation.

    So it seems that the hide menutiems which contains some of the same name like Page in the end?

    These part is in the xslt file:

    <xsl:with-param name="menuItems" select="$Navigation.rootNode/ancestor-or-self::* [@level=number($Navigation.fromLevel - 1)]/* [@isDoc and not(contains($Navigation.ignoreDocumentTypes, name())) and ( ( $Navigation.isSitemap != '1' and string(./umbracoNaviHide) = '0' ) or ( $Navigation.isSitemap = '1' and string(./umbracoSitemapHide) = '0' ) )]" />
    <xsl:variable name="childMenuItems" select="./* [@isDoc and not(contains($Navigation.ignoreDocumentTypes, name())) and ( ( $Navigation.isSitemap != '1' and ( string(./umbracoNaviHide) = '0' or string(./umbracoNaviHide) = '0' ) ) or ( $Navigation.isSitemap = '1' and (string(./umbracoSitemapHide) = '0' or string(./umbracoSitemapHide) = '' ) ) )]"/>

    /Bjarne

  • Rune Grønkjær 1372 posts 3103 karma points
    Jun 18, 2012 @ 08:25
    Rune Grønkjær
    0

    Hi Bjarne,

    Yes, it's the contains part. Did you find a solution? There may be others that would like a fix on that.

    /Rune

  • Bjarne Fyrstenborg 1284 posts 4038 karma points MVP 8x c-trib
    Jun 18, 2012 @ 10:17
    Bjarne Fyrstenborg
    0

    Hi Rune..

    No, I haven't find a solution right now.. I could use Hide from navigation (umbracoNaviHide), but I might use some of the blog pages in the navigation, so it won't be the best solution..

    Later I will try to write the check with the doctype alias directly in the xslt file, to see if it might be a problem with the ignoreDocumentTypes parameter or what cause this bug..

    Does the contains function check on the whole string or only a part of it?

    The values uBlogsyContainerPage  and uBlogsyPage affect Page doctype in the navigation. So it seems to that it match some of the string and therefore also hide the standard pages.

    /Bjarne

  • Rune Grønkjær 1372 posts 3103 karma points
    Jun 19, 2012 @ 09:30
    Rune Grønkjær
    0

    It's certainly the contains thingy, which is too greedy in your case.You might be able to split the commalist and use the individual tokens for a compare.

    /Rune

  • Bjarne Fyrstenborg 1284 posts 4038 karma points MVP 8x c-trib
    Jul 31, 2012 @ 18:29
    Bjarne Fyrstenborg
    0

    Hi Rune

    When the xslt loop through the nodes and get a node which use Page as doc type and the ignoreDocumentTypes has a value TabPage it returns true.. and some other cases as well, when the as document type name match a part of another doc type name in ignoreDocumentTypes..

    I think there is a bit more work to get it working with a comma separated list..  e.g. here: http://stackoverflow.com/questions/8500652/comma-separated-string-parsing-xslt-to-for-each-node substring-before and substring-after is used..

    But for now I solved it with help from Chriztian Steinmeier: http://our.umbraco.org/forum/developers/xslt/33507-Hide-pages-with-specific-doc-types

    Instead of a comma separated list I have this:

    <umbraco:Macro fromLevel="4" numberOfLevels="5" showOnlyCurrentPath="1" useSelfAsRoot="0" isSitemap="0" navigationId="submenu" rootPage="" ignoreDocumentTypes="|News|TabPage|" imageProperty="" sort="" Alias="Navigation" runat="server"></umbraco:Macro>
    

    And then in xslt changed these two lines from name() to concat('|', name() ,'|')

    <xsl:with-param name="menuItems" select="$Navigation.rootNode/ancestor-or-self::* [@level=number($Navigation.fromLevel - 1)]/* [@isDoc and not(contains($Navigation.ignoreDocumentTypes, concat('|', name(),'|'))) and ( ( $Navigation.isSitemap != '1' and string(./umbracoNaviHide) = '0' ) or ( $Navigation.isSitemap = '1' and string(./umbracoSitemapHide) = '0' ) )]" />
    <xsl:variable name="childMenuItems" select="./* [@isDoc and not(contains($Navigation.ignoreDocumentTypes, concat('|', name(),'|'))) and ( ( $Navigation.isSitemap != '1' and ( string(./umbracoNaviHide) = '0' or string(./umbracoNaviHide) = '0' ) ) or ( $Navigation.isSitemap = '1' and (string(./umbracoSitemapHide) = '0' or string(./umbracoSitemapHide) = '' ) ) )]"/>

    /Bjarne

  • Rune Grønkjær 1372 posts 3103 karma points
    Aug 01, 2012 @ 08:00
    Rune Grønkjær
    1

    Thanks. I will see if I can implement it as standard in the starter kit. Should be a good addition.

    /Rune

Please Sign in or register to post replies

Write your reply to:

Draft