Copied to clipboard

Flag this post as spam?

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


  • lucuma 261 posts 563 karma points
    Dec 03, 2010 @ 19:39
    lucuma
    0

    tagsLib:getContentsWithTags('tag')

    There doesn't seem to be a lot of documentation for this library..  This doesn't seem to accept a comma delimited list of tags as the name would seem to indicate..  I'm trying to get a list of related posts based on a tag list.. For instance, a post might have 3 tags (tag1, tag2, tag3) and I want to show all other posts that have one of those tags.  Is there a way to do this.  It seems that I could loop over the tags and call getContentsWithTags for each tag however I'm not sure how I'd deal with duplicates?  Any help would be appreciated.

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Dec 03, 2010 @ 20:50
    Morten Bock
    0

    What kind of result are you getting from the method? Nothing? An Error?

    Just looked at the source, and i _should_ support a comma separated list. However, it looks like it is performance intensive, since it get a whole lot of documents directly from the database, so if you expect a lot of traffic you might want to add some caching, or build some other way of getting the data.

    Look here for a sample of how to use it:

    http://blog4umbraco.codeplex.com/SourceControl/changeset/view/54177#916036

    You could probably do it directly in xslt if you wanted, just by comparing strings.

  • lucuma 261 posts 563 karma points
    Dec 03, 2010 @ 21:00
    lucuma
    0

    Cool, that's what I needed and worked great. I customized my implementation with new xlts and I guess I just overlooked that one!  Appreciate it. 

Please Sign in or register to post replies

Write your reply to:

Draft