Dear all
I recently tried changing a couple of my cacheable snippet calls [[...]] (one for my own snippet, and one for Ditto), to non-cacheable snippet calls [!...!], but for some reason modx fails to parse and execute the non-cacheable snippet calls. Instead the snippet call appears as is in the web page and the presence of the & symbol in the parameters of the Ditto snippet call breaks my xhtml. When I replace the brackets by double square ones, the snippet call is parsed and executed as normal.
I am not sure how to debug this one. I am sure I have used non-cacheable snippet calls in the past without problem. Are there any conditions under which non-cacheable snippet calls can’t be used? Can they be placed in snippets executed with the modx api runSnippet function? Is there any other information about the pages on which these calls are that I could provide that would help diagnose the problem? I am using modx 0.9.6. (I’ll be moving to a new server in a month’s time and I’ll upgrade to the latest version then.)
Thanks,
Paul
-
MODX Staff
- 12,272 Posts
I think this was a known issue with 096 actually that was resolved in 0961... but I can’t recall exactly. I suspect they’re on a non-cached page though, which means you shouldn’t need to call them uncached anyways..
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
-
MODX Staff
- 10,725 Posts
I don’t believe this has anything to do with the MODx version. I believe you are experiencing problems caused by either phX or Ditto itself. But I can’t say exactly what it is without a little more information about the exact snippet calls in question.
Here’s some more info on the Ditto call. It is
[[Ditto? &language=`japanese-utf8` &parents=`5` &display=`all` &sortBy=`menuindex` &sortDir=`DESC` &depth=`1` &tpl=`NewsItem` &dateSource=`pub_date` &dateFormat=`%Y-%m-%d`]]
The call is in a chunk, that is executed with a getChunk api call that’s within a non-cacheable snippet call that’s within the template for the page in question. I’ll report back with more info on the other snippet call shortly...
Paul
Oops. Sorry. The problematic snippet call is actually non-cacheable...
[!Ditto? &language=`japanese-utf8` &parents=`5` &display=`all` &sortBy=`menuindex` &sortDir=`DESC` &depth=`1` &tpl=`NewsItem` &dateSource=`pub_date` &dateFormat=`%Y-%m-%d`!]
On further experimentation, there is no problem with the non-cacheable snippet call when it is placed directly in the template. It’s only when it’s placed in a chunk that’s called from a snippet that there is a problem. I haven’t yet checked if the type of snippet that it is in (cacheable or non-cacheable) makes a difference.
Paul
On further investigation, it’s only a problem when a non-cacheable snippet call is placed within a chunk that’s executed using getChunk from within a non-cacheable snippet call. I believe this to be a bug. Are there any volounteers that would be prepared to confirm this, with versions 0.9.6 et 0.9.6.1 ? It appears to be a bug with any snippet calls, not just Ditto, with parameters or otherwise.
Thanks,
Paul
It’s good to know that using non-cacheable snippet call within a non-cacheable snippet call is not possible at present, at least in terms of syntax. Please can you tell me if and where these rules written down so that I can look them up?
I would have guessed that anything placed within a non-cacheable snippet would be executed every time that snippet was called, whether it was a cacheable snippet call, non-cacheable snippet call or otherwise. Is that assumption true? I’d like to know how the logic of these things works so that I can be sure that my site will be updated as I expect.
Thanks,
Paul
-
MODX Staff
- 10,725 Posts
MODx does not currently support tags of the same type embedded within one another, e.g. [!snippet?¶m=`[!embeddedSnippetFromChunk!]`!] will not work, regardless of how you try to trick the parser by placing the embedded tag in chunks, placeholders, tvs, etc. This is the problem and known limitation which will be resolved in the next major release (i.e. 0.9.7).
Thanks for the clarification. That’s quite a simple rule to follow. I also look forward to the next major version.
Please can you tell me what actually happens when I put a cacheable snippet call within a non-cacheable snippet though? Does anything get cached?
Thank you,
Paul