We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16834
    • 93 Posts
    Hello

    I am trying to help navigation through quite a large site (several hundred pages) by using tags on the more detailed pages.

    I have a "Related Pages" chunk that runs in the right-hand column of my site. This chunk returns a Ditto (v2.1.0) generated list of pages that share the same tags as the page being viewed. This works great on pages that are tagged.

    I have an issue where the page being viewed is without a tag. My "related pages" chunk display EVERY page on the site that also has no tag.

    As far as I can see there are two options: a) only display the "related pages" chunk on pages that are tagged, or b) filter the Ditto output to exclude pages with no tags.

    I have tried and failed to do a) above and am now trying b).

    I cannot work out how to create a filter that excludes null tags. Can anybody help me?

    If it helps, my full Ditto call is

    [!Ditto? &parents=`70` &tpl=`DittoTemplate2` &depth=`0` &tagData=`docTags` &tags=`[*docTags*]` &tagDelimiter=`,` &filter=`id,[*id*],2|docTags,'',8` &display=`all` !]


    The first filter excludes the current page from the "related pages" listing. I am having trouble with the second filter (after the ’|’).

    Thanks in advance

    Lee
      • 18397
      • 3,250 Posts
      Change the 8 to a 2 in the filter parameter.
        • 16834
        • 93 Posts
        Thanks for the suggestion but that makes no difference. I had tried this already but have just checked it again. Ditto still returns every page with no tag assigned (several hundred of them).

        If I assign the tag "test" to a handful of pages, I know that &filter=’docTags,test,8` works correctly - these pages are excluded from the Ditto results.

        The issue, as far as I can see, is how *the lack* of any tag is recognised by Ditto. Is it a NULL array or something? I have tried using ’@EVAL return NULL;’ as the comparator and this also fails.

        Any other clues would be very welcome.

        Alternatively, can anyone guide me on how to stop the "related pages" chunk being displayed on a page with no docTags value? Is there a way of conditionally displaying based upon a TV value (or lack of)? I have tried TV Conditional (http://modxcms.com/TV-Conditional-607.html) but this does not appear to work with recent versions of modx.

        Many thanks

        Lee
          • 18397
          • 3,250 Posts
          Could you provide the debug data for Ditto. Information on how to retrieve it can be found on the policy sticky in this board.
            • 16834
            • 93 Posts
            Sure. Please find attached. Hope this is what you need....

            btw. the Policy doc says "Rename the extension to .html" but this forum does not allow .html attachments. Have zipped.

            L
              • 16834
              • 93 Posts
              bump.

              Still cannot get to the bottom of this. Would really appreciate someone’s help on this if possible...

              L
                • 18397
                • 3,250 Posts
                Will take a look later today
                  • 18397
                  • 3,250 Posts
                  &filter=`id,[*id*],2|docTags,,2` should work
                    • 16834
                    • 93 Posts
                    Hi Mark

                    That’s what I had thought previously but I tried it again and still get a long list of pages.

                    If it helps, the "Filters" tab in the debug window reads as follows:

                    source value mode
                    id 7 2
                    docTags 2

                    Is it possible that Ditto doesn’t like two consecutive comma’s in the filter and is taking the digit ’2’ to refer to the filter value?

                    L
                      • 18397
                      • 3,250 Posts
                      It is definitely possible. You might want to try writing an extender based on the example extender included. (Make sure you have the latest development version first)