We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18399
    • 60 Posts
    As part of the plans I made for my website I have a structure where I want to be able to have a container to cover a specific news event.

    I have say

    Event (container)

    Substories

    but also different sections

    maybe Video, Author1, Author2 which would be connected to this event.

    I have an eventCode template variable which I use to connect all stories on the site connected to this event. The plan eventually is to maybe have a database with all sorts of date and other information on the event and use this code. But right now I want to do something else.

    What I want to do on the front page is to call the Event (container) and some basic information from it which I’ve done successfully using a ditto call which finds the Event containers I want and passes them to a chunk.

    I then want to take the eventCode and search the whole site and produce a list of articles all over the website generated from within the chunk I generated above. This has to be automatic. So I ask, is there a way of taking the eventCode, searching the entire site, and producing a list, prefereably excluding the event container itself.

    The idea would be that I have a basic series of boxes on the front page with the key stories. This surely should be possible but I can’t work out how. I’m thinking I might yet again have to go to a snippet, but it isn’t such an outrageous thought (almost every news site does this, story along with releated materials) so maybe there is an easy way I missed.

    Any suggestions or pointers?

      • 18399
      • 60 Posts
      OK I have the book Modx Web Development and it gives this example:

      [!Ditto? &parents=`47` &filter=`tvBlogcategories,[*Blogcategories*],7 |id,[*id*],2`!] as a way of doing the filtering I want.

      I tried to reproduce this with:
      [!Ditto? &parents=`50, 54` &depth=`4` &tpl=`xxxxdittotemp3` &filter=`eventCode, [*eventCode*], 2`!]

      which produces a list that isn’t filtered at all and has all articles that are children of sections 50 and 54.

      [!Ditto? &parents=`50, 54` &depth=`4` &tpl=`xxxxdittotemp3` &filter=`eventCode, [*eventCode*], 7`!]

      I change it to 7 at the end and no articles appear.

      Notice here I didn’t use the formulation tveventCode which the documentation says you don’t need to use tv before your own template variable name and indeed its true it makes no difference.

      Note also that within the template I managed to display the correct output for [*eventCode*] so the value is being read correctly.

      I also tried values 1-8. I had high hopes for 8 which is the one I would have chosen from this list:

      is not equal to the criterion (!=) 1
      is equal to the criterion (==) 2
      is less than the criterion (<) 3
      is greater than the criterion (>) 4
      is less than or equal to the criterion (<=) 5
      is greater than or equal to the criterion (>=) 6
      does not contain the text of the criterion 7
      does contain the text of the criterion 8

      So as far as I can see I exactly reproduced the book and it just didn’t work. What am I missing? This is driving me nuts. Nothing seems to work first time.

      All this is generated from a chunk.
        • 18399
        • 60 Posts
        I think I cracked it. There can’t be any spaces in a filter statement.

        &filter=`eventCode, [*eventCode*]`

        should be &filter=`eventCode,[*eventCode*]`