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.
<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>
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?
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.
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.
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?
Try this:
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?
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
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
Thanx Dan!
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
What setting did I miss? What should I do to get it working like on your demo page?
Kind regards,
León
Hi Leon
It seems that somewhere in your code you are still referencing the
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
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.
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
is working on a reply...