Copied to clipboard

Flag this post as spam?

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


  • RolandWolters 42 posts 63 karma points
    Jun 25, 2010 @ 22:09
    RolandWolters
    0

    Porting dandrayne's Business Starter Pack to 4.5 - xslt horrors

     

    So to play around with umbraco 4.5 I downloaded and installed the Business Website Starter Pack. The installation went ok, but of coure I need to edit the xslt files.

    I started with "topnavigation". Seems easy enough... NOT

    This is the origininal one:

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

     <!--
      Find the homepage (the topmost node in this tree section, with a doctype alias of 'homepage')
     -->
     <xsl:variable name="homePageNode" select="$currentPage/ancestor-or-self::root/node [@nodeTypeAlias='Homepage']" />
     
     
     <ul class="nav">
      <!-- we can assume that we'll need a homepage link in this nav -->
      <li>
       <xsl:if test="$currentPage/ancestor-or-self::node [@level=1]/@id = current()/@id">
        <xsl:attribute name="class">current</xsl:attribute>
       </xsl:if>
       <!-- NiceUrl takes a node ID and gives us a 'nice url' to the page -->
       <a href="{umbraco.library:NiceUrl($homePageNode/@id)}">
        <xsl:value-of select="$homePageNode/@nodeName" />
       </a>
      </li>
      
      <!-- this loop takes all of the direct children of the homepage that aren't currently hidden -->
      <xsl:for-each select="$homePageNode/node [string(./data [@alias='umbracoNaviHide']) != '1']">
       
       <li>
        <!-- a test to set the class of the link to the current page to 'current'
        
         basically it says:  If the current page or one if its parents has a node id equal to the id of the current page,
         set class to current
        -->
        <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id">
         <xsl:attribute name="class">current</xsl:attribute>
              </xsl:if>
        <a href="{umbraco.library:NiceUrl(current()/@id)}">
         <xsl:value-of select="current()/@nodeName" />
        </a>
       </li>
       
      </xsl:for-each>  
     </ul> 
    </xsl:template>

    </xsl:stylesheet>

     

    I kmow I have to do something with  "@isDoc" and doing that I have managed to get it to return one node... Not ok.

     

     did that by changed this line:

    <xsl:variable name="homePageNode" select="$currentPage/ancestor-or-self::root/node [@nodeTypeAlias='Homepage']" />

    to this

     <xsl:variable name="homePageNode" select="$currentPage/ancestor-or-self::root " />

    If I add the [@isDoc] to that it returns nothing...

     

    anyone?

     

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Jun 25, 2010 @ 22:42
    Morten Bock
    2

    Try this:

      <xsl:template match="/">
    
        <!-- 
      Find the homepage (the topmost node in this tree section, with a doctype alias of 'homepage')
     -->
        <xsl:variable name="homePageNode" select="$currentPage/ancestor-or-self::root/Homepage" />
        <ul class="nav">
          <!-- we can assume that we'll need a homepage link in this nav -->
          <li>
            <xsl:if test="$currentPage/ancestor-or-self::* [@level=1]/@id = current()/@id">
              <xsl:attribute name="class">current</xsl:attribute>
            </xsl:if>
            <!-- NiceUrl takes a node ID and gives us a 'nice url' to the page -->
            <a href="{umbraco.library:NiceUrl($homePageNode/@id)}">
              <xsl:value-of select="$homePageNode/@nodeName" />
            </a>
          </li>
          <!-- this loop takes all of the direct children of the homepage that aren't currently hidden -->
          <xsl:for-each select="$homePageNode/* [@isDoc and umbracoNaviHide != '1']">
            <li>
              <!-- a test to set the class of the link to the current page to 'current' 
         basically it says:  If the current page or one if its parents has a node id equal to the id of the current page, 
         set class to current
        -->
              <xsl:if test="$currentPage/ancestor-or-self::*/@id = current()/@id">
                <xsl:attribute name="class">current</xsl:attribute>
              </xsl:if>
              <a href="{umbraco.library:NiceUrl(current()/@id)}">
                <xsl:value-of select="current()/@nodeName" />
              </a>
            </li>
          </xsl:for-each>
        </ul>
      </xsl:template>

     

  • RolandWolters 42 posts 63 karma points
    Jun 25, 2010 @ 23:43
    RolandWolters
    0

    Hey dat works.... allmost. Small thing; the class for the list-item representing the current page should be set to current. It doesn't do that....

    I can't figure out why... you?

  • dandrayne 1138 posts 2262 karma points
    Jun 25, 2010 @ 23:57
    dandrayne
    0

    Hi Roland

    I'll be updating the starter kit this week so that it supports 4.5 (was caught out with the release whilst I was at codegarden!).  Sorry about that! 

    I've also got a v2 in the works that should be a big improvement.

    Cheers,
    Dan

  • dandrayne 1138 posts 2262 karma points
    Jun 30, 2010 @ 18:32
    dandrayne
    1

    Hi Roland

    I've updated the xslt files for 4.5 and added them to http://our.umbraco.org/projects/starter-kits/business-website-starter-pack

    Hope this helps,
    Dan

  • RolandWolters 42 posts 63 karma points
    Jul 04, 2010 @ 23:45
    RolandWolters
    0

    Thanx Dan!

  • León van de Pavert 15 posts 37 karma points
    Aug 20, 2010 @ 16:34
    León van de Pavert
    0

    I just installed the business website starter pack and it is up and running. http://symbioosi.idbbn.fi/home.aspx and all other pages seem OK.

    http://symbioosi.idbbn.fi/ does not show the home.aspx page but instead gives the following error

    template    Master template is the same as the current template. It would course an endless loop!

    Unhandled Execution Error   
    Cannot find ContentPlaceHolder 'RunwayMasterContentPlaceHolder' in the master page '/umbraco/masterpages/default.master', verify content control's ContentPlaceHolderID attribute in the content page.
      at System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection)
      at System.Web.UI.MasterPage.get_Master()
      at System.Web.UI.MasterPage.ApplyMasterRecursive(MasterPage master, IList appliedMasterFilePaths)
      at System.Web.UI.Page.ApplyMasterPage()
      at System.Web.UI.Page.PerformPreInit()
      at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    What setting did I miss? What should I do to get it working like on your demo page?

    Kind regards,
    León

  • dandrayne 1138 posts 2262 karma points
    Aug 20, 2010 @ 16:40
    dandrayne
    0

    Hi Leon

    It seems that somewhere in your code you are still referencing the

    RunwayMasterContentPlaceHolder

    content area, which is not used in the starter kit (it's intended as a runway alternative, not a supplement).

    So I'd look through your templates for a reference to this content area and remove it, or if you're happy to send login details to [email protected] I'd be happy to give it a quick look over.

    Cheers,
    Dan

  • Ferdy Hoefakker 214 posts 248 karma points
    Aug 20, 2010 @ 16:45
    Ferdy Hoefakker
    0

    Check your templates. There is no "RunwayMasterContentPlaceHolder" in the master page "/umbraco/masterpages/default.master".

    You will either need to select the correct master page or rename the ContentPlaceHolderId you are refering to in the asp:content tag.

  • León van de Pavert 15 posts 37 karma points
    Aug 23, 2010 @ 08:39
    León van de Pavert
    0

    Hi all,

    It is a clean install of Umbraco 4.5.1 for .NET 4 with Contour, XSLTSearch 2.8.1 and Business Website Starter packages. I was surprised with the Runway template error; I was very sure I did not install the Runway package! It seemed that the XSLTSearch template (Runway Module) caused the error so I uninstalled it and installed the Stand-alone version.

    It turned out I forgot to set the domain in the "Manage Hostnames" settings, silly me.

     

    Thanks,
    León

Please Sign in or register to post replies

Write your reply to:

Draft