We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25046
    • 194 Posts
    I am not having success with the latest (Version 1.0.5) tagLinks snippet. An example link that is being outputted is the same as what others have described previously. For example, here is what the snippet currently produces as a link:

    mysite.com/categories?tags=website

    INSTEAD of something that would work like:

    mysite.com/categories/website

    I am using ModX 0.9.6.2

    Any suggestions? Thanks!
      • 2762
      • 1,198 Posts
      Anyone can help me to replace the "+" with "%20" character in taglink code?

      Example
      from:
      sitename.com/article.html&tags=tag+name

      to:
      sitename.com/article.html&tags=tag%20name

      to have the same link path of Ditto tags


      Sorry I’m not a coder undecided

      Thanks kiss
        Free MODx Graphic resources and Templates www.tattoocms.it
        -----------------------------------------------------

        MODx IT  www.modx.it
        -----------------------------------------------------

        bubuna.com - Web & Multimedia Design
        • 2762
        • 1,198 Posts
        Ok solved using Ditto instead of TagLinks, inside the document. grin

        Works exactly like Taglinks, but with urls of Ditto.

        Using Ditto instead of TagLinks:

        Ditto call, inside document:

        [!Ditto? &documents=`[*id*]` &tpl=`dittotagstpl` &tplTagLinks=`tplTagLinks` &tagDisplayDelimiter=`,`  &tagDelimiter=`,`&tagData=`documentTags` !]


        Ditto template (dittotagstpl)
         tags: [+tagLinks+]
          Free MODx Graphic resources and Templates www.tattoocms.it
          -----------------------------------------------------

          MODx IT  www.modx.it
          -----------------------------------------------------

          bubuna.com - Web & Multimedia Design
          • 12379
          • 460 Posts
          As per mglerner’s comment, I can’t get the resulting url to display as /category/website instead of /category?tags=web+site. Looking at the code in v1.05 I can’t see anything to suggest it could be displayed as a friendly url. Take a look:

          /**
          * Build the URL
          */
          $url_seperator = (strpos($path, '?') === false)?'?':$amp;
          $doc_path = $path.$url_seperator.'tags=';
          


          If there’s somebody out there keen to have a crack at it please it would be great to have a parameter giving the option to display as either. Also would be neat to have the option of using a dash between tags in the alias naming in keeping with Modx default url format ie /category/web-site...
            Mostly harmless.
            • 12379
            • 460 Posts
            OK, here’s my quick fix for v1.05 which appears to test fine. I’m no php programmer but this seems to work.

            Replace:

            $url_seperator = (strpos($path, '?') === false)?'?':$amp;
            $doc_path = $path.$url_seperator.'tags='; 


            With:

            $doc_path = $path.'/';
            


            And replace two instances of:

            $url = urlencode(trim($tvarray[$x]));


            With:

            $out = trim($tvarray[$x]);
            $url = str_replace(" ", "-", $out); 


            This will make all two tag words separated by a space hyphenate, while tags separated by a comma will be separate tag links.

            ie tags: "web site, jungle" will display as two links, "/category/web-site" and "/category/jungle"

            Would be neat to have a parameter to switch between "/category/web-site" and "/category?tags=web+site" as mentioned in the previous post if anybody’s up for it.
              Mostly harmless.
              • 15599
              • 27 Posts
              Hello, I am using the following in my Ditto’s home page template to act as a category link:
              [[tagLinks? &id=`[+id+]` &tv=`categories` &separator=`, ` ]]


              Nothing is showing up, though. I have a TV called categories, and I made a test document with it checked. It’s coming up blank, though.

              Ugh, it’s because I am using Evolution and not 0.9.6.
                • 4628
                • 58 Posts
                Hi!
                I want to use tagLinks with modx 1.0.2. Unfortunately I got following php error message on my news page after installing the snippet:

                MODx Parse Error

                MODx encountered the following error while attempting to parse the requested resource:

                PHP Parse Error

                PHP error debug
                Error: implode() [function.implode]: Invalid arguments passed
                Error type/ Nr.: Warning - 2
                File: /my-path/manager/includes/document.parser.class.inc.php(770) : eval()’d code
                Line: 98

                Here the document.parser.class.inc.php:

                elseif ($type == ’REDIRECT_HEADER’ || empty ($type)) {
                // check if url has /$base_url
                global $base_url, $site_url;
                if (substr($url, 0, strlen($base_url)) == $base_url) {
                // append $site_url to make it work with Location:
                $url= $site_url . substr($url, strlen($base_url));
                }
                if (strpos($url, "\n") === false) {
                $header= ’Location: ’ . $url;
                LINE 98: } else {
                $this->messageQuit(’No newline allowed in redirect url.’);
                }
                }
                if ($responseCode && (strpos($responseCode, ’30’) !== false)) {
                header($responseCode);
                }
                header($header);
                exit();
                }
                }

                It seems that tagLinks is not working with modx 1.0.2. Does anybody know more about that? I really would like to use the tagLinks snippet ...

                Thanks

                carlina
                  • 13427
                  • 6 Posts
                  Hi to all from Italy..

                  My [[tagLinks]] works ok, but i have the error below only when i create a document not published and click preview.
                  I think the issue for me is here:

                  $get_tags = isset($value) ? $value : implode($delimiter,$modx->getTemplateVarOutput($idname=array($tv), $page_id,$published="1"));

                  where $published is set to 1. Is there a way to see the unpublished documents?

                  Help me

                  Modx version 1.0.2

                  Thank to all

                  Max

                  ----------------------
                  « MODx Parse Error »
                  MODx encountered the following error while attempting to parse the requested resource:
                  « PHP Parse Error »

                  PHP error debug
                  Error: implode() [function.implode]: Bad arguments.
                  Error type/ Nr.: Warning - 2
                  File: /accounts/sinfonialab/www/clickmyclip/manager/includes/document.parser.class.inc.php(770) : eval()’d code
                  Line: 98

                  ---------------------
                    • 16278
                    • 928 Posts
                    I got around a similar problem in a snippet called from a chunk that is shared by published and unpublished items like this:
                    $varContent = $modx->getTemplateVar($tv,'*',$id,1);
                    if (empty($varContent)) $varContent = $modx->getTemplateVar($tv,'*',$id,0);
                    
                    where the 1 and 0 arguments at the end of the API function are for "published" and "unpublished". I tried "*" in this position for "don’t care", but that caused a database error.
                    smiley KP
                      • 13427
                      • 6 Posts
                      I solved with a trick.
                      I create a snippet that get the status variable value.
                      So if value is 1 (published) echo the snippet taglinks else echo nothing. It’s not the best solution but so i can view the preview of the documents without taglinks. Below my snippet. Sorry for my english. Hi to all

                      <?php
                      $tv23 = $modx->getTemplateVar(’published’, ’*’, $id_documento, 1);
                      $src23=$tv23[’value’];

                      if ($src23==1){
                      echo ’<div class="ditto_tags">[[tagLinks? &id=`[+id+]` &tv=`docTags` &separator=`, ` &fap=`1` &label=`Tags: ` &style=`dittoTags` &path=`risultati-tags`]]</div>’;
                      }
                      else{
                      echo ’’;
                      }
                      ?>