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

    I have a problem when displaying information of a resource. After the first call I get a cached version althought I use [[!getResources]] not [[getResources]].

    My details:

    I link from another page via:
    <a href="[[~15 ?job=`[[*id]]`]]"><strong>A link to a form...</strong></a>


    At the affected site I fetch the job parameter and the data through getResources:

     
    [[!getUrlParam? &name=`job` &int=`1`]] //works always
    [[!getResources? &resources=`[[!getUrlParam? &name=`job` &int=`1`]]`]] //works first time
    


    At the first time (first loading after saving or clearing cache) all is working. But after that getResources only takes the id from the first call.
    It’s not a problem of getUrlParam. It shows always the correct parameter!

    It seems to be a cache problem. Any suggestions?

    loxy
    • Look at the cached Resource file and see if you can find the getResources tag in the elementCache entries. If it’s not there, it’s not being cached and the problem likely is due to the properties you are passing (or not passing) to the Snippet.
        • 17552
        • 46 Posts
        The cached file shows (in the elementCache entry):
        [[!getUrlParam? &name=`job` &int=`1` &tpl=`Tpl_Job_Bewerbung`]]
        [[!getResources? &resources=`8` &tpl=`Tpl_Job_Bewerbung`]]
        


        So the actual parameter of getUrlParam is not used any more. The orginal parameter is frozen. Does this mean the problem lies in getUrlParam?

        loxy
        • No, it’s not necessarily an issue with the Snippet. This seems to be an issue or limitation in the way the parser is handling the properties when caching them; it definitely needs more investigation. If you be so kind as to enter this at http://bugs.modx.com/projects/revo/issues I will follow up and make sure we figure out what is happening and how we can resolve the problem or improve the behavior.

          FWIW, what happens if you add an extra property to the tag string in one of the getUrlParam calls? e.g.

          [[!getUrlParam? &name=`job` &int=`1`]] //works always
          [[!getResources? &resources=`[[!getUrlParam? &name=`job` &int=`1` &instance=`2`]]`]] //works first time
            • 17552
            • 46 Posts
            It has the same effect.

            The cached file shows:
            [[!getResources? &resources=`11`]]


            I added:
            [[!getResources? &resources=`[[!getUrlParam? &name=`job` &int=`1` &instance=`2`]]`]]


            But I don’t get the approach. What should do that? Besides, there is no instance parameter in getUrlParam, so far as I know...

            I will enter an issue...thanks

            loxy
            • The issue is that any two instances of an element in the cache that have the exact same property signature per request, will only be executed once. The "dummy" instance parameter was just to see if the problem was related to per request caching, or the general caching of the property signature. It appears to be the latter. Thanks for taking the time to discuss your issue and enter the ticket.
                • 17552
                • 46 Posts
                OK. I get the point.
                I created an issue: http://bugs.modx.com/issues/2838

                I have to thank you...
                  • 15022
                  • 31 Posts
                  Hello,
                  I’m having a similar issue with a nested getResources call. The intention is to show class categories with a title and description, then all (or some) of the upcoming classes below each. As you can see, the first set of classes is always repeated but the section titles and descriptions are being processed correctly.. any recommendations are greatly appreciated.

                  I have turned off caching for the pages but that doesn’t seem to be working.
                  Thank You!

                  http://artistreevt.org/class-categories/
                    illegitimati non carborundum
                  • That really sounds like a job for Wayfinder, producing nested lists with a single Snippet call.

                    If you want help with your getResources calls, you’ll need to provide the calls or some additional information about them.
                      • 15022
                      • 31 Posts
                      Thanks for the tip. I’m going to try Wayfinder now and see what happens. I guess it was just habit and not thought that made me use getResources. This is a job I would have used Ditto for in Evo since the templating was so flexible but it does require a bunch of recursion so it does make sense. Thanks again.
                        illegitimati non carborundum