I'm looking at replicating a similar effect to the our umbraco dashboard and realised I have no idea what best practice is for limiting the number of items returned.. I have a content folder called resources inside that there will be 5 differenent categories which will each have faqs, whitepapers etc and wanted to retrieve the most recently created faqs etc for all categories a user has permission to access and limit it to a list of 10 articles etc..
I was just wondering best practice for only taking the top 10??
i was thinking approach wise I'd assign all faq's across categories to a variable then all whitepapers etc and then foreach over each variable and generate the lists..
You don't need to use an xslt extension, just an xslt macro. Xslt extension is for using a .net code from within xslt.
Xslt is perfect this sort of thing!
The general rule for using xslt is: - If the required function is primarily front end based (rendering data from umbraco ect), use an xslt macro; - If the required functon is more complex (forms with server side actions ect), and difficult to do from within xslt, use a .net usercontrol macro.
replicate our umbraco dashboard
Hi guys,
I'm looking at replicating a similar effect to the our umbraco dashboard and realised I have no idea what best practice is for limiting the number of items returned.. I have a content folder called resources inside that there will be 5 differenent categories which will each have faqs, whitepapers etc and wanted to retrieve the most recently created faqs etc for all categories a user has permission to access and limit it to a list of 10 articles etc..
I was just wondering best practice for only taking the top 10??
i was thinking approach wise I'd assign all faq's across categories to a variable then all whitepapers etc and then foreach over each variable and generate the lists..
cheers,
Tom
I would use an xslt macro to traverse the node structure of the resources node.
Something like this:
<xsl:variable name="noItemsToDisplay" select="number(10)" />
<xsl:for-each select="$currentPage/ancestor-or-self::node [@nodeTypeAlias = 'resourceNodeType']/descendant::node">
<xsl:if test="position() <= $noItemsToDisplay">
<!-- Render the html for you items -->
</xsl:if>
</xsl:for-each>
NOTE: I have just free typed this, so syntax may not be 100%. You will also need to replace resourceNodeType with your nodeTypeAlias.
How this helps
Cheers,
Neil
Thanks Neil! I was thinking that but was wondering if it would be overkill to employ an xslt extension
Cheers,
Tom
You don't need to use an xslt extension, just an xslt macro.
Xslt extension is for using a .net code from within xslt.
Xslt is perfect this sort of thing!
The general rule for using xslt is:
- If the required function is primarily front end based (rendering data from umbraco ect), use an xslt macro;
- If the required functon is more complex (forms with server side actions ect), and difficult to do from within xslt, use a .net usercontrol macro.
I want know the architecture of umbraco. So please help me on that asap
is working on a reply...