Copied to clipboard

Flag this post as spam?

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


  • Tom 713 posts 954 karma points
    Feb 15, 2010 @ 06:26
    Tom
    0

    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

  • Neil Campbell 58 posts 182 karma points
    Feb 15, 2010 @ 06:53
    Neil Campbell
    1

    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() &lt;= $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

     

  • Tom 713 posts 954 karma points
    Feb 15, 2010 @ 06:56
    Tom
    0

    Thanks Neil! I was thinking that but was wondering if it would be overkill to employ an xslt extension

    Cheers,

    Tom

  • Neil Campbell 58 posts 182 karma points
    Feb 15, 2010 @ 07:07
    Neil Campbell
    0

    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.

     

  • sadara 2 posts 22 karma points
    Mar 17, 2010 @ 06:41
    sadara
    0

    I want know  the architecture of umbraco. So please help me on that asap

Please Sign in or register to post replies

Write your reply to:

Draft