We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31912 MODX Staff
    • 95 Posts
    Sorry for this being kind of a cross post – but I am looking for a solution even if it requires approaching this slightly different and it might be missed posted exclusively under the getResources section.

    Here is what I am trying to achieve:

    I have a TV (using the autotag tv which is great for this) that holds services tags. This TV is accessible to both the services template and the projects template. Each project resource can be tagged with multiple services. The services resource is tagged with the tag associated directly with the resource. I am currently using a getResource snippet to list the projects on the services page that have been tagged with the associated services (so the water page is tagged with water service tag.) This listing needs to be temptable with TVs because it contains an image thumbnail along with a few other pieces of information unique to the projects template. Here is my current setup: http://modxcms.com/forums/index.php/topic,53828.0.html

    Initially, it seemed to be working by using the wildcard % after the tag listing, then I realized it wasn’t listing a project that was tagged with more than one – it would only list the first one. So I added a % in front of the tag and it seemed to fix it and I left it as-is. In the final testing stage a problem was found, there are two services – one water and one wastewater and using this method it seems that projects tagged as wastewater also show up on the water services page.

    The main thing I need to make sure is that I can use a tpl that accepts TVs to template the output of the listing. Any thoughts on how to achieve this? I know I could do this in Ditto but really trying to avoid using that in revolution.

    Thanks!
    Dustin
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: waldus68 at Sep 02, 2010, 11:05 AM

      Initially, it seemed to be working by using the wildcard % after the tag listing, then I realized it wasn’t listing a project that was tagged with more than one – it would only list the first one. So I added a % in front of the tag and it seemed to fix it and I left it as-is. In the final testing stage a problem was found, there are two services – one water and one wastewater and using this method it seems that projects tagged as wastewater also show up on the water services page.

      The main thing I need to make sure is that I can use a tpl that accepts TVs to template the output of the listing. Any thoughts on how to achieve this? I know I could do this in Ditto but really trying to avoid using that in revolution.
      The missing feature in getResources that prevents this from working is being able to do post-query filtering, which is how Ditto achieved this. It is something that I want to add to getResources, or solve through another Snippet that is designed to efficiently do these kinds of searches without resorting to wildcards, but my time is divided amongst other responsibilities at the moment. However, I may have found a workaround for you using the REGEXP operator available in MySQL. I’ll update you as soon as I work it out.
        • 31912 MODX Staff
        • 95 Posts
        Thanks Jason for looking into this. Any guidance would be much appreciated. It was one of those bugs that snuck up on me really late in the project that I wish I caught earlier.

        Also great to hear that there is a possibility for this feature in the future.
          • 31912 MODX Staff
          • 95 Posts
          Sorry to dig this up again, anyone have a potential temporary solution for this? This site is set to launch later this week and this is the only remaining critical bug. I am checking to verify with the client, but maybe if limited to these two tags I can just have them artificially insert a character into the water of wastewater section.

          Thanks for any help.