Copied to clipboard

Flag this post as spam?

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


  • Sherry Ann Hernandez 320 posts 344 karma points
    Oct 20, 2010 @ 13:06
    Sherry Ann Hernandez
    0

    Error in navigation url

    Hello,

    It's me again.

    I have a content that looks like this.

    Home

       - Meetings and Events

           - Meetings and conferences

          - Social Events

      - Hotel 1

      - Hotel 2

     

    When I try to access the links on the level 2 navigation everything works well but when I try to access the level 3 navigation, example I click the meetings and conferences and then try to go back to level 2 navigation, Im now encountering a problem because the navigation now looks for the link under the meetings and events.

    My url now looks like http://localhost/home/meetings-and-events/home.aspx instead of http://localhost/home/home.aspx

     

    How do I make my navigation retain its url regardles of the page I click?

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Oct 20, 2010 @ 13:27
    Dirk De Grave
    0

    Can you show us your xslt you've got so far for building up the navigation?

     

    Cheers,

    /Dirk

  • Sherry Ann Hernandez 320 posts 344 karma points
    Oct 20, 2010 @ 13:29
    Sherry Ann Hernandez
    0

    Here's my xslt file

     

    <?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 id="nav">
        <li id='navMain2'><a href='en.aspx' title='Home' class="selected">Home</a></li>
        <li id='navMain3'><a href='#' title='Hotels'>Hotels</a>
            <ul>
                <li><a href='dubai-flora-grand-hotel.aspx' title='Flora Grand'>Flora Grand Hotel</a></li>
                <li><a href='dubai-hotel-florida-international.aspx' title='Florida International'>Hotel Florida International</a></li>
                <li><a href='dubai-florida-hotel.aspx' title='Florida Hotel'>Florida Hotel Dubai</a></li>
            </ul>  
         </li>
         <li id='navMain4'><a href='#' title='Hotel Apartments'>Hotel Apartments</a>
             <ul>
                <li><a href='dubai-flora-hotel-apartments.aspx' title='Flora Hotel'>Flora Hotel Apartments</a></li>
                <li><a href='dubai-flora-creek-hotel-apartments.aspx' title='Flora Creek'>Flora Creek Hotel Apartments</a></li>
                <li><a href='dubai-flora-park-hotel-aparments.aspx' title='Flora Park'>Flora Park Hotel Apartments</a></li>
             </ul>
          </li>
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
          <li class="navMain5">
      <a href="{umbraco.library:NiceUrl(@id)}">
       <xsl:value-of select="@nodeName"/>
      </a>
     </li>
    </xsl:for-each>
    </ul>

    </xsl:template>

    </xsl:stylesheet>

  • Sherry Ann Hernandez 320 posts 344 karma points
    Oct 20, 2010 @ 13:33
    Sherry Ann Hernandez
    0

    And then this is my right navigation xslt.

    Supposedly for each item selected on my top navigation a corresponding links will be shown on the right side bar.

     

    <?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="2"/>

    <xsl:template match="/">

    <!-- The fun starts here -->
    <ul>
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
     <li>
                 <a href="{umbraco.library:NiceUrl(@id)}">
                     <xsl:if test="$currentPage/@id = current()/@id">                           
                          <xsl:attribute name="class"><xsl:text>selected</xsl:text></xsl:attribute>                       
             </xsl:if>
                     <xsl:value-of select="@nodeName"/>
         </a>
     </li>
    </xsl:for-each>
    </ul>

    </xsl:template>

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Oct 20, 2010 @ 13:38
    Dirk De Grave
    0

    I'm pretty sure it's because of the relative links on your navigation, try changing so "/" is included in your href attribute.

    For example, don't use:

    <li id='navMain2'><a href='en.aspx' title='Home' class="selected">Home</a></li>
    

    but instead, use

    <li id='navMain2'><a href='/en.aspx' title='Home' class="selected">Home</a></li>

    (NiceUrl() will do this by default for you, but if you're including other links, add a "/")

    Also, it's generally a bad idea to not use the NiceUrl(), because your document name may change and your link will become broken.ยต

    For example:

    <a href='dubai-flora-grand-hotel.aspx' title='Flora Grand'>Flora Grand Hotel</a>

    will be broken is someone changes the name from 'Dubai Flora Grand Hotel' to 'Dubai Flora Big and Grand Hotel'

    Hope this helps.

    Regards,

    /Dirk

     

     

     

  • Sherry Ann Hernandez 320 posts 344 karma points
    Oct 20, 2010 @ 14:11
    Sherry Ann Hernandez
    0

    I will change the hotel link and not use hard coded href values.

    But for the home page because my client wants to include a home link, I try your suggestion to put a "/" on my href values but now

    what it does is go to this url http://localhost/en.aspx instead of http://localhost/florahospitality/en.aspx.

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies