I have looked around with no luck to finding the solution to this. The goal is to have one page that can serve (show/hide various data items) based on the URL.
What I have is a document type with 3 custom properties. Lets call them Prop1/Prop2 and Prop3. All properties are of type (Rich Editor)
What I would like to do is have some logic is xslt that will pick up the URL and based on the path, render the appropiate Prop data only.
Example,
domain.com/Prop1/Welcome.aspx will show a page with the Prop1 content data only.
domain.com/Prop2/Welcome.aspx will show a page with the Prop2 content data only and so on.
I have it setup so the welcome page is a linked page so this is all happening on the page. I just need thre ability to make it dynamic based on the URL.
You've probably figured out a solution for this, but thought I'd offer this little code snippet...
<!-- gets the URL -->
<xsl:variable name="url" select="umbraco.library:RequestServerVariables('URL')" />
<!-- loops through each of the document's properties (e.g. ones that DONT have @isDoc attribute) -->
<xsl:for-each select="$currentPage/*[not(@isDoc)]">
<!-- tests if the URL contains the property's name/alias -->
<xsl:if test="contains($url, name())">
<!-- if so, then output the inner text/content -->
<xsl:value-of select="text()" />
</xsl:if>
</xsl:for-each>
Render different document type data based on url
Hi All
I have looked around with no luck to finding the solution to this.
The goal is to have one page that can serve (show/hide various data items) based on the URL.
What I have is a document type with 3 custom properties.
Lets call them Prop1/Prop2 and Prop3. All properties are of type (Rich Editor)
What I would like to do is have some logic is xslt that will pick up the URL and based on the path, render the appropiate Prop data only.
Example,
domain.com/Prop1/Welcome.aspx will show a page with the Prop1 content data only.
domain.com/Prop2/Welcome.aspx will show a page with the Prop2 content data only and so on.
I have it setup so the welcome page is a linked page so this is all happening on the page. I just need thre ability to make it dynamic based on the URL.
Any suggestions?
Thanks
Hi J,
You've probably figured out a solution for this, but thought I'd offer this little code snippet...
Cheers, Lee.
is working on a reply...