Copied to clipboard

Flag this post as spam?

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


  • Peter Duncanson 430 posts 1360 karma points c-trib
    Nov 10, 2009 @ 17:43
    Peter Duncanson
    0

    tagsLib methods. Is there any documentation?

    Noticed Blog4Umbraco uses a new library function to me "tagsLib" yet I can't find the source for it anywhere or any documentation. What can you do with tagsLib?

    I'm wanting to render out a list of tags for each blog post but have the tags clickable to search for those tags. Currently I'm looking at splitting the tags data node on the comma and taking it from there but it could be that the tagsLib could give me some nicer methods of doing just that.

    Any pointers or ideas?

  • Sebastiaan Janssen 5061 posts 15523 karma points MVP admin hq
    Nov 10, 2009 @ 17:50
    Sebastiaan Janssen
    0

    The sourcecode is available from: http://blog4umbraco.codeplex.com/

    What you're trying to do however, already works like that in the blog package itself, here's a xslt snippet:

    <xsl:for-each select="tagsLib:getTagsFromNode(@id)/tags/tag">
        <a href="{umbraco.library:NiceUrl($currentPage/@id)}?filterby={.}"><xsl:value-of select="."/></a>
        <xsl:if test="position() != last()">,&nbsp;</xsl:if>
    </xsl:for-each>

    And here's the filter (earlier on in that xslt):

    <xsl:value-of select="count($currentPage/ancestor-or-self::node [@nodeTypeAlias = 'Blog']//node [@nodeTypeAlias = 'BlogPost' and contains(Exslt.ExsltStrings:lowercase(./data [@alias='tags']), Exslt.ExsltStrings:lowercase($filter))])"/>

    This can be found in BlogListPost.xslt

  • Peter Duncanson 430 posts 1360 karma points c-trib
    Nov 10, 2009 @ 19:09
    Peter Duncanson
    0

    Ahhh was looking in the wrong template! Doh.

    No luck with the source code though, theres an initial check on on code plex but no mention of the tagsLib that I can see? Nor is it in the package, that just has the DLL in it?

  • Sebastiaan Janssen 5061 posts 15523 karma points MVP admin hq
    Nov 10, 2009 @ 21:21
    Sebastiaan Janssen
    0

    Oh I think the tags datatype is a default Umbraco datatype, so you'd have to look for it in the source of the Umbraco project.

    Let me tell you though, that it's just a comma-seperated string, so you approach is fine.

Please Sign in or register to post replies

Write your reply to:

Draft