We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6726
    • 7,075 Posts
    Here is my "problem" : I want to build a related link list, which will be displayed at the bottom of each articles. There is the ListRelated snippet, sure, but I need to randomize and add advanced filters so it won’t do.

    Each article has a TV (named keyword) defined with a list of Keywords (multiple checkbox so that the user can check all associated keywords).
    I have to list 5 random links for each keyword the current article has in common with other articles.

    Here is my ditto call for keyword 1 :

    <ul>
    [!Ditto? &parents=`0` &depth=`6` &display=`5` &randomize=`1` &filter=`keyword,keyword 1,1|id,[*id*],2` &tpl=`tpl_list_related` &noResults=` `  &showPublishedOnly=`1`!] 
    </ul> 
    


    Notice I use the second filter to filter out the current article ( id,[*id*],2 ).
    Works just great smiley

    The only thing is, I have to build a call for each keyword, manually...
    Not that great undecided

    Now, I have never used the Tag mode, maybe there is something there that could achieve what I want (any pointer ?)
    Or a little snippet to cycle through the values of the keyword TV ?

    How would you go about this ?
    Thanks !
      .: COO - Commerce Guys - Community Driven Innovation :.


      MODx est l&#39;outil id
      • 18397
      • 3,250 Posts
      Yes, tag mode is the solution to this. What you want to do is set &tags=`[*mytags*]` &tagData=`mytags` &tagDelimiter=`,` where mytags is the tv holding your tags that has the delimited list widget turned on with a comma as the character.
        • 6726
        • 7,075 Posts
        Thanks Mark !
        I’ll try that and report smiley
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l&#39;outil id
          • 11975
          • 2,542 Posts
          David,

          are you trying to build a list for each keywords as said here


          I have to list 5 random links for each keyword the current article has in common with other articles.

          If it’s the case you ’ll have to write a little snippet to call ditto as many times as you have keywords for the current document

          Is that correct ?

          :-)
            Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
            • 6726
            • 7,075 Posts
            Yes that’s what I need, didn’t have the chance to test the Tag mode, wouldn’t it work ?
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l&#39;outil id
              • 11975
              • 2,542 Posts
              tagMod Will do the trick but you’ll have to set the tv value in each ditto call.

              the easiest way to avoid to write this by hand would be to code a snippet to explode the keywords of the current doc and then execute ditto with modx->runSnippet.


              :-)

                Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                • 6726
                • 7,075 Posts
                Then TagMode would not do anything I can’t do with my current method, and solve my problem...

                Looks like I’ll have to get down to writing my first snippet then tongue
                Thanks for the tip !
                  .: COO - Commerce Guys - Community Driven Innovation :.


                  MODx est l&#39;outil id
                  • 6726
                  • 7,075 Posts
                  Quote from: heliotrope at May 03, 2007, 12:41 PM
                  tagMod Will do the trick but you’ll have to set the tv value in each ditto call. the easiest way to avoid to write this by hand would be to code a snippet to explode the keywords of the current doc and then execute ditto with modx->runSnippet. smiley

                  Finally, I ended up trying the tag mode anyway tongue
                  I had some trouble understanding the logic of writing a tag mode call at first, but it finally worked (thanks to the debug window ! better than a tutorial grin)

                  I have set up this call which works just as I need it :

                  [!Ditto? &id=`lire_aussi` &parents=`0` &depth=`6` &display=`5` &randomize=`1` &filter=`id,[*id*],2|keywords,none,2` &tags=`[*keywords*]` &tagData=`keywords` &tagDelimiter=`-` &tagMode=`onlyTags` &tagDisplayMode=`2` &debug=`1` &tpl=`tpl_lire_aussi`  &noResults=` ` &showPublishedOnly=`1`!] 


                  As before, I have filtered out the current doc but I also had to assign a value to the keywords TV (here, "none") and filter it out also (strange, isn’t it ?).
                    .: COO - Commerce Guys - Community Driven Innovation :.


                    MODx est l&#39;outil id
                    • 21191
                    • 236 Posts
                    Now I"m having issues, I’m using DItto2 however.

                    I’m trying to pull a related list.
                    here is my call
                    [!Ditto? &startID=`0` &summarize=`10` &total=`10` &tpl=`related_doc_tpl` &paginate=`0` &sortBy=`editon`  &sortDir=`DESC`   &descendentDepth=`5` &tagDelimiter=`,` &tagData=`tvtags` &tagMode=`onlyTags` &tags=`[*tags*]`!]


                    I’ve also tried using [*tags*] in the tageData field as well. and then in the debug it shows the tags being listed, however in this tag only "Tags" has any values ..

                    ANyway, what I did was I made a TV to hold all the tags it’s called "tags", and it it’s a delimited list, with the pipes and all that and it seems to work fine, I check boxes on different pages for the tv and such.

                    all I want to do is pull other documents with similar tags, and list them.

                    here is the url
                    http://4nsi.wavestatic.com/products/x-view-products/t-160-tank-inspection-system this url has the tags and debug mode on, if anyone wants to take a look.
                      ~Shawn Himmelberger
                      Check out my MODx Development and MODx Design Company - Himmelberger Design