We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26435
    • 1,193 Posts
    Quote from: Mark at Dec 16, 2006, 01:13 PM

    Please note that this feature is in Ditto 1.1 Beta 1 or later so if you are using that version please use the [+tags+] placeholder for optimum performance.
    How is that optimum performance?
    Ditto does not generate the Tag, it is the output of a TV. tagLinks uses the MODx API, it is < 20 lines of actual code, AND it can be called from any page, not just pages with Ditto on it. I use this snippet not only for my ditto template, but also on each document, letting the viewer see the other tags while they are viewing the document. Using this snippet would certainly cause less overhead than putting a Ditto call on each page, and, until I run some tests I won’t have statistical numbers, but I am willing to bet that using [[tagLinks]] vs using [+tags+] in the ditto template is going to be a push. either way will work equally fast. Please show me your statistics on [+tags+] being "optimal". I am not saying this as a challenge, or because I believe one way is better than the other. that will be the preference of the user. It’s just that this claim seems a bit outrageous and I have to say "show me the data". I understand you are personally vested in Ditto and you want to show off it’s capabilities and make users aware of new features, but your claim here makes this [[tagLinks]] snippet look poorly written, slow, and/or useless, which is simply not true.

    Of course I am personally vested in this snippet grin LOL, but I will try to not take your comments personally. wink

    -sD-
    Dr. Scotty Delicious, Scientist.
      Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
      All of the above... in no specific order.


      I send pointless little messages
      • 18397
      • 3,250 Posts
      Scotty,

      I should clarify. I was saying that if you are using Ditto to display a list of documents with tags, use the tags placeholder so you don’t have the overhead of calling a snippet inside of a snippet. In otherwords, running an eval inside an eval is very slow. I apologize if my previous comment made it seem that I thought tagLinks was "poorly written, slow, and/or useless". I assure you I do not think that way. In fact, I think the exact opposite. You can run tagLinks on any page to display its associated tags. That is an extremely desireable feature. I was just trying to avoid the "why does (or doesn’t) Ditto do this (this way)" question which always seems to popup in the Ditto forums...
        • 30481
        • 33 Posts
        If I am using the [[TagLinks]] call directly inside my post, ther are not wrote by the ditto called.
        It is possible ? (the problem is that the snippet is not renderer for the post document but for the document where the ditto call is)

        I did’nt success to specify the base link of TagLink to can be a basic ditto call (for exemple &path=`blog.html&tags=`). the problems is the & character, that is normally used betwwen the snipet parameter.

        The feature that could be very cool is that the path parameter could be absolute (with the all adress: http:\\www.???? )
        With this last feature we could put tag link with technorati link for example.....
          -------------------------------
          www.fabienletort.com
          • 26435
          • 1,193 Posts
          Quote from: totor at Dec 18, 2006, 03:43 AM

          If I am using the [[TagLinks]] call directly inside my post, ther are not wrote by the ditto called.
          It is possible ? (the problem is that the snippet is not renderer for the post document but for the document where the ditto call is)

          I did’nt success to specify the base link of TagLink to can be a basic ditto call (for exemple &path=`blog.html&tags=`). the problems is the & character, that is normally used betwwen the snipet parameter.

          The feature that could be very cool is that the path parameter could be absolute (with the all adress: http:\\www.???? )
          With this last feature we could put tag link with technorati link for example.....
          How are you setting up your tags that they are using an ampersand?
          Have you taken a look at this page in the wiki?: http://wiki.modxcms.com/index.php/Tagged_blogging_with_Ditto
          This is the way tagLinks is supposed to be used, but feel free to customize it however you see fit, it is GPL.
          Good luck,

          -sD-
          Dr. Scotty Delicious, Scientist.
            Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
            All of the above... in no specific order.


            I send pointless little messages
            • 26435
            • 1,193 Posts
            I am using it on each document as well. (I also use it in my ditto call, but each MODx document in my site has tags attached to it, so I use tagLinks to get the through the category pages I have set up at http://scottydelicious.com/categories/pirate for example).
            here is the call I use in each of my MODx documents (it is actually hard coded into my template right above the [*content*] call.
            [[tagLinks? &tv=`tags` &separator=`, ` &element=`p` &style=`dittoTags` &fap=`1` &path=`categories`]]
            

            I hope that helps. for more info, see this wiki page.

            -sD-
            Dr. Scotty Delicious, Scientist.
              Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
              All of the above... in no specific order.


              I send pointless little messages
              • 867
              • 241 Posts
              Hi.

              This snippet seems great but i wonder..how to use it without category..? grin

              I just have a plain tag cloud but don’t really use category on this web site
              and a ditto call for the results..( i have plenty of tags..~80 items)

              But i would love to have something similar to your systeme.
              Is it possible to use ditto and something to get the tags and make the links..
              or is there a way to do it with tagLinks ??

              Thanks in advance and also for creating/sharing this already usefull snippet.

              Alchime
              (fr)
                • 26435
                • 1,193 Posts
                Take a look at ditto 1.1 beta 2 on the forums. I think Mark mentioned something about a placeholder that it sets for links from tags.

                -sD-
                Dr. Scotty Delicious, Scientist.
                  Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
                  All of the above... in no specific order.


                  I send pointless little messages
                  • 867
                  • 241 Posts
                  i will ! Thanks. laugh
                    • 30897
                    • 311 Posts
                    Hi,
                    This snippet is very interessant but why it didn’t work with page keywords...

                    PS : sorry for my english... i’m french...
                      TylerD - In MODx we trust
                      [Derni
                      • 15360
                      • 20 Posts
                      I was playing around with the taglinks snippet, and thought of a way to get rid of the separator after the last tag item.

                      I’m not a PHP-expert (yet wink) but maybe this is a solution for some of us, at least for me it is working great:

                      First of all, you have to make sure that you use friendly paths, and that the paths are named the same as your tags.
                      For instance if you have two categories: ’category1’ and ’category2’, than you should make sure that the path to the category (landing) pages are also "...yourpath/category1" and "...yourpath/category2".

                      Then, you can replace the following code in the tagLinks snippet (I am using version 1.0.1):

                      /**
                      * Create a series of HTML anchors with hrefs if &format
                      * is set to `a`.
                      */
                      if ($format == 'a'){
                      $link .= "$label";
                      	foreach ($tvarray as $value){
                      		$url = str_replace(' ', '', $value);
                      	    $link .= '<a href="'.$doc_path.strtolower($url).'">'.$value.'</a>'.$separator.$nl;
                      	}
                      
                      } else {


                      Replace it with this code:
                      /**
                      * Create a series of HTML anchors with hrefs if &format
                      * is set to `a`.
                      */
                      if ($format == 'a'){
                      
                      $lasttag = array_pop($tvarray);
                      
                      	foreach ($tvarray as $tagwithlink){ 
                      		$withlinks = str_replace('%taglink%', $tagwithlink, '<a href="[(baseurl)]'.$path.'/%taglink%" class="'.$style.'">%taglink%</a>'.$separator.' ');
                      		print_r($withlinks);}
                      
                      	$lastwithlinks = str_replace('%taglinklast%', $lasttag, '<a href="[(baseurl)]'.$path.'/%taglinklast%" class="'.$style.'">%taglinklast%</a>');
                      	print_r($lastwithlinks);
                      
                      } else {


                      You can see that I split the inital array in to two variables, one containing the tags without the last tag, and one variable with just the last tag. This way you can present both variables, and do something different with the last tag item. Maybe this is not a ’beautiful’ code, but it is simple and it does its job.