Copied to clipboard

Flag this post as spam?

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


  • Danny Gelens 6 posts 23 karma points
    Jul 30, 2009 @ 14:24
    Danny Gelens
    0

    TagCloud for a website, not for a blog

    I'm making a site where i want to have an TagCloud. After a little search I found a package of Christoph Ertl but this one is for a blog.

    I tried to modify it a little but i'm stucked now.

    On the page it shows the TagCloud including the tags in the different sizes.

    When I click on one of the tags in the TagCloud i go to another page with an extention ?filterBy=tagname. (for example: localhost/tag-result.aspx?filterBy=Umbraco)

    But this page doesnt show anything.

    What I want is that when I click on the tag Umbraco I go to a page like an resultpage of a search engine but only with pages who's got the umbraco tag.

    I think i have to do this in an XSLT file?

     

  • rasb 162 posts 218 karma points
    Jul 30, 2009 @ 15:30
    rasb
    0

    Hi Danny,

    You could also do this by using a .Net control. For example this:

    http://thetagcloud.codeplex.com/

    /RasB

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Jul 30, 2009 @ 15:35
    Thomas Höhler
    0

    I'va made a tag cloud (blogcumulus): http://blog.thoehler.com/2009/05/14/new-package-blogcumulus-v10-published

    Just look into the code and modify as you want.

    Thomas

  • Simon Probert 21 posts 45 karma points
    Jul 30, 2009 @ 15:38
    Simon Probert
    0

    There are several ways of doing it but yes you can grab the querystring in xslt and process it.

    I had a look at that tag cloud package a little while back and determined that while it could be done, it would require a fair bit of xslt work almost to the point of it being easier to simply write your own tagcloud in xslt from scratch

    O hold on I'm not sure I understood the question.

    Ok if you go to the results page simply put an xslt macro on there that searches your tags for umbraco and lists the ones that match the filter... If you install Tim Geyssens Blog4Umbraco from the package repository in umbraco you can see how it's done in there there's a good example of filtering on tags

  • Chris Dunn 75 posts 127 karma points
    Jul 30, 2009 @ 15:40
    Chris Dunn
    0

    The querystring of filter='' alone doesn't return the results but is only a parameter you use when querying the nodes. Yes you will need to implement the filter in the XSLT macro you are using to display the results.

    You will need to use the tags library when getting the nodes to display, like :

    <xsl:for-each select="tagsLib:getAllTagsInGroup('whatever')/tags/tag">

    Read more of the example here: http://our.umbraco.org/wiki/reference/xslt/snippets/tag-cloud

     

    -Chris

  • Danny Gelens 6 posts 23 karma points
    Jul 31, 2009 @ 16:17
    Danny Gelens
    0

     

    Thanks guys for helping me on the good road!

    After 4 hours I made, I installed the Blog4umbraco and watched to the code. I had to search because first i get an error that it couldn't find the taglib (i installed the blog4umbraco on another testsite). Finaly i found out that i had to config the taglib in the xsltExtensions.config.

    Then i used the code from Tim (blog4umbraco) and removed everything i didn't need.

    So now it is looking like this:

    1. Tagcloud.dll from Christoph Ertl

    2. XSLT from Tim Geyssens 

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet 
        version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        xmlns:msxml="urn:schemas-microsoft-com:xslt"
        xmlns:umbraco.library="urn:umbraco.library"
        xmlns:tagsLib="urn:tagsLib"
        xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
        xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" 
        exclude-result-prefixes="msxml umbraco.library tagsLib Exslt.ExsltStrings">
    
    
    <xsl:output method="html" omit-xml-declaration="yes"/>
    
    <xsl:param name="currentPage"/>
    
    <xsl:variable name="filter">
        <xsl:choose>
            <xsl:when test="string-length(umbraco.library:Request('filterby')) &gt; 0">
                <xsl:value-of select="umbraco.library:Request('filterby')"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="''"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    
    <xsl:template match="/">
    
    <xsl:if test="$filter != ''">
    
    <xsl:for-each select="$currentPage/ancestor-or-self::node [@nodeTypeAlias = 'Home']//node [@nodeTypeAlias = 'Tekstpagina' and contains(Exslt.ExsltStrings:lowercase(./data [@alias='tagcloudKeywords']), Exslt.ExsltStrings:lowercase($filter))]">
    <xsl:sort select="@createDate" order="descending" />
            <xsl:call-template name="showresult">
                <xsl:with-param name="result" select="."/>
            </xsl:call-template>
    </xsl:for-each>
    </xsl:if>
    
    </xsl:template>
    
    <xsl:template name="showresult">
        <xsl:param name="result"/>
            <h2 id="result-{$result/@id}"><a href="{umbraco.library:NiceUrl($result/@id)}">
                <xsl:value-of select="$result/@nodeName"/></a></h2>
                <xsl:value-of select="$result/data [@alias = 'bodyText']" disable-output-escaping="yes"/>
            <p class="postTags">
                <div style="font-size: 100%; color: #545454;"><strong>Trefwoorden: </strong>
                <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>
                </div>
            </p>
    </xsl:template>
    </xsl:stylesheet>

     

    Maby someone can see if i did it right? But thanks guys for helping me!

     

Please Sign in or register to post replies

Write your reply to:

Draft