We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6316
    • 92 Posts
    Heya, I spent a damn day to figure out that $modx->setPlaceholder(’name’, "value"); doesn’t work with [! !] "uncached" call.

    Thing is, my snippet just doesn’t work when its called [[ ]].

    Any ways to fix the problem / walk-around?

    Thanks in advance.
      • 26903
      • 1,336 Posts
      OK, do you mean :-
      doesn’t work with [! !] "uncached" call.

      or

      doesn’t work when its called [[ ]]

      ?


        Use MODx, or the cat gets it!
        • 22303 MODX Staff
        • 10,725 Posts
        Quote from: Daedalus at Nov 13, 2008, 10:22 AM

        Heya, I spent a damn day to figure out that $modx->setPlaceholder(’name’, "value"); doesn’t work with [! !] "uncached" call.

        Thing is, my snippet just doesn’t work when its called [[ ]].

        Any ways to fix the problem / walk-around?

        Thanks in advance.
        Turn the caching option off for the page and your snippet will work using [[ ]] and placeholders will not be cached by the first access to the snippet. wink
          • 6316
          • 92 Posts
          Quote from: shamblett at Nov 13, 2008, 12:46 PM

          OK, do you mean :-
          Sorry for not being clear, I’m forced to use [! !] because my snippet gets some parameters out of $_GET, but setPlaceholder() won’t work with [! !]. I’ve made a walkaround (better said, a dirty hack): my snippet gets called 4 times on a page -- all with different parameters -- and it acts pretty much like a placeholder.

          Turning caching off is of course a solution, but not rly perfect undecided
            • 22303 MODX Staff
            • 10,725 Posts
            Quote from: Daedalus at Nov 14, 2008, 01:50 PM

            Sorry for not being clear, I’m forced to use [! !] because my snippet gets some parameters out of $_GET, but setPlaceholder() won’t work with [! !]. I’ve made a walkaround (better said, a dirty hack): my snippet gets called 4 times on a page -- all with different parameters -- and it acts pretty much like a placeholder.

            Turning caching off is of course a solution, but not rly perfect undecided
            The other option is to make sure all your placeholders appear within content that is not getting cached (i.e. returned by a snippet called via API or with non-cacheable tags, [! !]. But I use dynamic pages without caching all the time, because some pages simply do not make sense to cache at all. And being able to put placeholders anywhere in these layouts is much more convenient for my designers than the milliseconds you might save by using partial page caching on pages that are bottle-necked by the non-cacheable scripts being executed anyway.