We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17883
    • 1,039 Posts
    *** UPDATE 25.04.06: New version attached ***

    Hi there,

    some say they are useless, some say they are evil, but why not make them usable with modx wink

    What is a tag cloud?

    A tag cloud is a list of tags that are linked to an overview or to the search (like in this case). The sense is imho to give a visitor a qucik overview of what is the site all about. The words (tags) are counted and weighted - the more they occur in the content, the bigger the link is displayed. There are two possibilities to achieve that:

    1. For every document you publish, you define some tags (like "modx, css, ajax, cms"). These tags are then counted and weighted
    2. Automatically: All words are counted and weighted (with the possibility to filter out common words)

    I chosed the second alternative, because the first one seems imho to be a "self fulfilling prophecy", because your tagging never will be neutral and you will influence the cloud by adding tags to your documents that don´t match that much - just to get the words in there which you like.

    Snippet

    The snippet is called like:

    [[tagcloud?parent=`1,3,5,6,7,14`&min=`3`&landing=`12`]]


    parent: The folders where your to be counted documents are in. Note: There is no multilevel yet, so set every folder where docs are in. [ 0 ]
    min: Minimum of occurrences for a single word to be displayed [2]
    landing: The id of your search result page. If you don´t have one, create a doc with content:

    [!FlexSearchForm?FSF_showResults=`1` &FSF_showForm=`0`!]


    At the top of the snippet code you see an array with the filter words, which shouldn´t be displayed:

    $exclude = array('',' ','  ','   ','and','a','-','—','–','the','—','to','.',':',',','in'); 	//exclude list
    


    here you put in common words which shouldn´t be displayed/linked. This is necessary, because otherwise you have a lot of counts for "in", "the" and so on. Just extend it like you wish.

    The rest is also commented in the code.

    The output is put in a div box with class "tagcloud", you can change that also in the code.

    Additionally the tags are linked to the search, because they have to be linked somewhere wink


    Example of the snippet
    (on the bottom right)

    Marc
      • 33337
      • 3,975 Posts
      Great Snippet man!

      You made my day! grin

      Thanks for sharing,

      regards,

      zi
        Zaigham R - MODX Professional | Skype | Email | Twitter

        Digging the interwebs for #MODX gems and bringing it to you. modx.link
        • 10487 MODX Staff
        • 1,535 Posts
        How cool is that! Thanks Marc for a great snippet smiley
          Garry Nutting
          Senior Developer
          MODX, LLC

          Email: [email protected]
          Twitter: @garryn
          Web: modx.com
          • 6726
          • 7,075 Posts
          Now that’s something which will definetly be attractive to power bloggers... and will do a lot to help manage complex content !

          Thanks a lot for this one grin

            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l'outil id
            • 17883
            • 1,039 Posts
            Thanks everyone smiley

            Now that’s something which will definetly be attractive to power bloggers...

            Wait until my trackback solution works wink The "pinging" of other blogs works, but the "fetching" of trackbacks and converting into comments drives me nuts at the moment undecided But I´m on the way wink
              • 6726
              • 7,075 Posts
              Trackbacks ? Well this is a VERY good news for blogging with MODx grin !
                .: COO - Commerce Guys - Community Driven Innovation :.


                MODx est l'outil id
                • 17883
                • 1,039 Posts
                Hmm, just tried to trackback your blog, but it didn´t work. It doesn´t send a proper XML answer, don´t know why. For my Wordpress-Test-blog it works well as far I can see... If I had known how complicated this kind of stuff is (for a non coder), I wouldn´t have started laugh Have to investigate this...
                  • 25663 MODX Staff
                  • 12,272 Posts
                  Marc, that is just too cool. Thanks so much for sharing. smiley

                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                    • 1764
                    • 680 Posts
                    Very cool. I’ve been thinking how cool it would be to do something like this for a while.
                      • 15987
                      • 786 Posts
                      This is a very cool snippet. Great work.

                      Since we are talking about blog related snippets, has anyone made a calendar snippet that has the days highlighted for each post? I can’t seem to find one in the forums. If not I am going to start working on one soon.