I am tasked with creating a tool through which users will be able to create multiple coupons. A coupon will typically include images and text which the user should be able to enter.
We will have 4 or 5 different types of coupon templates and corresponding document types.
I was thinking of creating a coupons folder under which users can create the coupons with appropriate data.
The part that I am struggling with is that when a user navigates to http://site.com/coupons.aspx, I want all the coupons that have been created to show up on this page one after the other.
I am able to access individual data items through xslt, but I would like to retrieve the fully rendered coupon page to embed in this page. Basically, I want the template code to be applied and then inserted into this page.
You could easily adapt Warrens XSLT file SubNavi.xsl in the CWS2 Package - This gets all the child pages of a node, so if they hit coupons.aspx anything created under the coupons page would be selected
Obviously you would need to add in your property names to pull out and display - If you have different templates then just use an 'if' @nodeTypeAlias = 'whatever' one bit of html and if @nodeTypeAlias 'another' then another bit of html etc..
I managed to figure it out. The solution was in "RenderTemplate" method in umbraco.library. I basically loop over all the child pages and call RenderTemplate providing it the child page id and child template id. Here is the snippet
Embed child pages in parent page
Hi all,
I am tasked with creating a tool through which users will be able to create multiple coupons. A coupon will typically include images and text which the user should be able to enter.
We will have 4 or 5 different types of coupon templates and corresponding document types.
I was thinking of creating a coupons folder under which users can create the coupons with appropriate data.
The part that I am struggling with is that when a user navigates to http://site.com/coupons.aspx, I want all the coupons that have been created to show up on this page one after the other.
I am able to access individual data items through xslt, but I would like to retrieve the fully rendered coupon page to embed in this page. Basically, I want the template code to be applied and then inserted into this page.
Is this even possible? Let me know.
Thanks
-zak
You could easily adapt Warrens XSLT file SubNavi.xsl in the CWS2 Package - This gets all the child pages of a node, so if they hit coupons.aspx anything created under the coupons page would be selected
Obviously you would need to add in your property names to pull out and display - If you have different templates then just use an 'if' @nodeTypeAlias = 'whatever' one bit of html and if @nodeTypeAlias 'another' then another bit of html etc..
Thanks for your reply Lee...
I managed to figure it out. The solution was in "RenderTemplate" method in umbraco.library. I basically loop over all the child pages and call RenderTemplate providing it the child page id and child template id. Here is the snippet
<xsl:output method="html"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:call-template name="drawNodes">
<xsl:with-param name="parent" select="$currentPage/ancestor-or-self::node [@level=1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="drawNodes">
<xsl:param name="parent"/>
<xsl:for-each select="$parent/node">
<xsl:call-template name="renderTemplate">
<xsl:with-param name="pageId" select="@id" />
<xsl:with-param name="templateId" select="@template" />
</xsl:call-template>
<hr/>
</xsl:for-each>
</xsl:template>
<xsl:template name="renderTemplate">
<xsl:param name="pageId"/>
<xsl:param name="templateId"/>
<xsl:value-of select="umbraco.library:RenderTemplate($pageId, $templateId)" disable-output-escaping="yes"/>
</xsl:template>
is working on a reply...