Copied to clipboard

Flag this post as spam?

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


  • praveen 113 posts 164 karma points
    Jul 19, 2011 @ 04:15
    praveen
    0

    UMBRACO 4.7 Top Navigation

    Hi there,

    I have this macro in the Master Template:

           <umbraco:Macro Alias="TopNavigation" runat="server"></umbraco:Macro>

    and this is the XSLT code
     

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">

    <xsl:output method="xml" omit-xml-declaration="yes" />

    <xsl:param name="currentPage"/>

    <!-- Input the documenttype you want here -->
    <!-- Typically '1' for topnavigtaion and '2' for 2nd level -->
    <!-- Use div elements around this macro combined with css -->
    <!-- for styling the navigation -->
    <xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::root" />

    <xsl:template match="/">

    <!-- The fun starts here -->
    <ul>
    <xsl:for-each select="$siteRoot/* [@isDoc and string(umbracoNaviHide) != '1']">
    <li>
    <xsl:if test="$currentPage/ancestor-or-self::*/@id = current()/@id">
    <!-- we're under the item - you can do your own styling here -->
    <xsl:attribute name="class">active</xsl:attribute>
    </xsl:if>
    <xsl:if test="count($siteRoot/* [@isDoc and string(umbracoNaviHide) != '1']) = position()">
    <!-- we're under the item - you can do your own styling here -->
    <xsl:attribute name="class">last</xsl:attribute>
    </xsl:if>
    <xsl:if test="$currentPage/ancestor-or-self::*/@id = current()/@id and count($siteRoot/* [@isDoc and string(umbracoNaviHide) != '1']) = position()">
    <!-- we're under the item - you can do your own styling here -->
    <xsl:attribute name="class">last active</xsl:attribute>
    </xsl:if>
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="@nodeName"/>
    </a>
    </li>
    </xsl:for-each>
    </ul>

    </xsl:template>

    </xsl:stylesheet>

    But I cant get the menu rendered on the page, please help

    Kind Regards

    Praveen

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 19, 2011 @ 05:23
    Fuji Kusaka
    0

    Hi Praveen, can you should us your Content Structure?

    Or you can try change this

    <!-- Input the documenttype you want here -->
    <!-- Typically '1' for topnavigtaion and '2' for 2nd level -->
    <!-- Use div elements around this macro combined with css -->
    <!-- for styling the navigation -->
    <xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::root" />
    <xsl:template match="/">

    <!-- The fun starts here -->
    <ul>
    <xsl:for-each select="$siteRoot/* [@isDoc and string(umbracoNaviHide) != '1']">
    <li>
    <xsl:if test="$currentPage/ancestor-or-self::*/@id = current()/@id">
    <!-- we're under the item - you can do your own styling here -->
    <xsl:attribute name="class">active</xsl:attribute>
    </xsl:if>
    <xsl:if test="count($siteRoot/* [@isDoc and string(umbracoNaviHide) != '1']) = position()">
    <!-- we're under the item - you can do your own styling here -->
    <xsl:attribute name="class">last</xsl:attribute>
    </xsl:if>
    <xsl:if test="$currentPage/ancestor-or-self::*/@id = current()/@id and count($siteRoot/* [@isDoc and string(umbracoNaviHide) != '1']) = position()">
    <!-- we're under the item - you can do your own styling here -->
    <xsl:attribute name="class">last active</xsl:attribute>
    </xsl:if>
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="@nodeName"/>
    </a>
    </li>
    </xsl:for-each>
    </ul>

     

    to

     

    <!-- Input the documenttype you want here -->
    <xsl:variable name="level" select="1"/>

    <xsl:template match="/">

    <!-- The fun starts here -->
    <ul>
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
      <li>
        <xsl:if test="$currentPage/ancestor-or-self::*/@id = current()/@id">
          <!-- we're under the item - you can do your own styling here -->
          <xsl:attribute name="class">active</xsl:attribute>
          </xsl:if>
        
           <xsl:if test="position()=last()">
           <!-- we're under the item - you can do your own styling here -->
             <xsl:attribute name="class">last</xsl:attribute>
           </xsl:if>
        <a href="{umbraco.library:NiceUrl(@id)}">
          <xsl:value-of select="@nodeName"/>
        </a>    
      </li>
    </xsl:for-each>
    </ul>

     

     

    //Fuji

     

  • praveen 113 posts 164 karma points
    Jul 19, 2011 @ 06:25
    praveen
    0

    Hi Fuli

    Many thanks for your help, my menu looks like this, its quite simple

    Home | Resources | Contact | Other Links | Other Resources | NZ FGM Programme

    I have changed the XSLT as advised, see below, but it still dose not work??

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">

    <xsl:output method="xml" omit-xml-declaration="yes" />

    <xsl:param name="currentPage"/>

    <!-- Input the documenttype you want here -->
    <xsl:variable name="level" select="1"/><xsl:template match="/">
    <!-- The fun starts here -->
    <ul>
        <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']"> 
       
        <li>   
            <xsl:if test="$currentPage/ancestor-or-self::*/@id = current()/@id">     
            <!-- we're under the item - you can do your own styling here -->    
            <xsl:attribute name="class">active</xsl:attribute>     
            </xsl:if>          
           
            <xsl:if test="position()=last()">      
            <!-- we're under the item - you can do your own styling here -->        
            <xsl:attribute name="class">last</xsl:attribute>      
            </xsl:if>   
           
            <a href="{umbraco.library:NiceUrl(@id)}">     
            <xsl:value-of select="@nodeName"/>    </a>     
         </li>
         </xsl:for-each>
    </ul>

    </xsl:template>

    </xsl:stylesheet>

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 19, 2011 @ 08:06
    Fuji Kusaka
    0

    Praveen can you send us a screenshot of your content node?....I just check the XSLT and its working, are all the nodes under the same level as your default node such as

    Content

    - Default(home)
    --  Resources 
    --- Contact
    --- Other Links
    --- Other Resources
    --- NZ FGM Programme


    //fuji

  • praveen 113 posts 164 karma points
    Jul 20, 2011 @ 00:12
    praveen
    0

    Hi Fujji

    Many thanks for your help :)

    Please find the content screen shot, the nodes which are highlighted are ment to be hidden from the top menu  "Hide From Menus"

    after installing 4.7 I have not installed any packages on top of this, do I need to install something for the Top Navigation to work?

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 20, 2011 @ 05:28
    Fuji Kusaka
    0

    Hi Praveen,

     

    There is no need to install any package to be able to view your Top Navigation. Just used the macro you previously created. From your screenshot, i would suggest you to move your innerpages (nodes) starting from Resources to Complicationsfgm like the example below.

    One way of doing this since you already created your content is Settings > Choose Homepage Document Type > Click Structure Tab > Check for the InnerPage Document Type.and Save.

    Go back to your Content section, right click on one your node and choose Move and Select Home node.

    Try with the first node Resources and see if your Top Navigation is showing up and carry one with the other nodes.

    //fuji

  • praveen 113 posts 164 karma points
    Jul 20, 2011 @ 07:05
    praveen
    0

    Hi Fuji many thanks I did what you recommended but it still dose not help

    Setting Screen Shot

     

     

    Content Tab

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 20, 2011 @ 07:31
    Fuji Kusaka
    0

    Praveen thats weird but you should be able to view your navigation by now. Try one last thing, create another XSLT Files and choose List Sub Pages By Level and insert it in your template.

    Give this a try and let me know what is the output. You might need to change your

    <xsl:variable name="level" select="2"/> 

    to

    <xsl:variable name="level" select="1"/>  


    Let me know if you are getting any output

  • praveen 113 posts 164 karma points
    Jul 20, 2011 @ 08:59
    praveen
    0

    HI Fuji

    I  have set the UseLegacyXmlSchema to FALSE is this the cause of the problem

    I am not able to get the search work as well, I have used the XSLTsearch 3.0 package?

    if you give me your email I can send the password to the site you can log in and see what the problem is.

    Thanks

    Praveen

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 20, 2011 @ 09:17
    Fuji Kusaka
    0

    I would suggest you set it back to true!! Here is my email drop me a mail [email protected]

     

    //fuji

  • praveen 113 posts 164 karma points
    Jul 20, 2011 @ 12:04
    praveen
    0

    HI Fuji

    I sent you the mail, lookforward to hear from you

    Many thanks for your help

    Regards

    Praveen

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 20, 2011 @ 12:12
    Fuji Kusaka
    0

    Ill have a look at it.

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 20, 2011 @ 20:02
    Fuji Kusaka
    0

    Hey Praveen i had a quick look to your search and seems to be working fine. Try to add some more fields in your searchFields macros to make your search more efficient.

     

    //fuji

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 21, 2011 @ 07:45
    Fuji Kusaka
    0

    Praveen under Home Document Type  > Click on Strucutre Tab and Checked Related Document Type (Allowed child nodetypes) to be able to create new node under your Home Node.

     

    //fuji

     

     

  • praveen 113 posts 164 karma points
    Jul 22, 2011 @ 00:17
    praveen
    0

    HI Fuji

    Many thanks for your help, it did work!

    Regards

    Praveen

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 22, 2011 @ 05:21
    Fuji Kusaka
    0

    great if you got it working.

     

    //fuji

Please Sign in or register to post replies

Write your reply to:

Draft