Show resources multiple times depending on dates

Hello Modx community,

I have created a website which provides information on trainings like title, descriptions aaaaaaaaaand dates. These information are shown on several pages; on some I inserted a list with getResources to display when the next trainings will take place.

The dates I use to sort the resources in the lists are stored in a TV with the shortcoming that I can only enter one date per training. But the trainings take place every 15 weeks. Hence, I (mis?)used the extra Tagger to add all available dates a) in the training lists and b) in the training description itself.

The lists are limited to 15 resources and any resource older than today is removed from the website.

The customer is very happy. :partying_face: But I’m not. :sweat_smile:

With this solution, I cannot make use of all dates stored within Tagger to create a list in which a specific training is displayed as often as dates are stored.


Preferred solution. Displaying the same resource multiple times. Just an example, no real alpacas. :stuck_out_tongue:

Any idea how I can make use of either getResources or Tagger or a combination of both to achieve this solution? If this was possible, an appointment which took place yesterday would automatically be displayed at the end of the list again.

Cheers,

Webdachs

P.S. As I may add one image only as a new user, I hope this helps enough to visualize what I’m trying to achieve.

Not sure I really understand what you are trying to do, but I guess you have to join the resource database table with the tables from Tagger.

With pdoResources (from the extra pdoTools) this should be possible. Something like this may work:

[[pdoResources?
    &parents=`0`
    &tpl=`@INLINE <p>{{+pagetitle}} ({{+id}}) | {{+tag}}</p>`
    &loadModels=`tagger`
    &innerJoin=`{
        "TaggerTagResource":{"class":"TaggerTagResource", "on":"modResource.id = TaggerTagResource.resource"},
        "TaggerTag":{"class":"TaggerTag", "on":"TaggerTagResource.tag = TaggerTag.id"}
    }`
    &select=`{
        "modResource": "*",
        "TaggerTag": "tag, rank"
    }`
    &sortby=`{
        "tag":"ASC"
    }`
]]

If this doesn’t work, then you probably have to write your own snippet to query the data.

I not sure what you want either, but as you probably know, Tagger is for categorizing things, not displaying schedules (which sounds like what you’re doing).

I wonder if making your TV hold a comma-separated series of dates would help. As halftrainedharry suggests, you’d need a custom snippet to process handle the current display.

Another possibility would be MIGX, which might let you store multiple dates in one MIGX TV and handle some of the processing for you.

maybe agenda would be something for you
Agenda • modmore.com

Thanks for pointing me to pdoResources and the possibility to use SQL with that. I’m going to check it!

Almost. I use a TV to display the appointments in a list with getResources but this TV can only hold one date at a time. The Tagger comes in handy to show all dates for a certain resources a) in the resources list and b) on the training page itself.

MIGX looks interesting. I’ll give it a try. Thanks.

I’ll have a closer look on that. Thanks.