Hy
sorry if there is an answer for this and i cant find it.
There is this strange problem
in several cases i have to call a snippet, tv, or placeholder two times to make it work (get the value)
For example:
I used the following chunk in a ditto call (the page that i used the ditto is uncached):
[tt]
<div [+phx:if=`[*Category*]`:is=`[+Category+]`:then=`class="menu_option_active"`:else=`class="menu_option"`+]>
<a href="[(site_url)][~[+id+]~]" title="Show [+pagetitle+]">[+pagetitle+]</a>
</div>
[/tt]
it didn’t work. BUT when i’ve inserted another call for tv and placehoder, everything worked fine. So the following code is the one who actually worked:
[tt]
<!--[*Category*][+Category+]-->
<div [+phx:if=`[*Category*]`:is=`[+Category+]`:then=`class="menu_option_active"`:else=`class="menu_option"`+]>
<a href="[(site_url)][~[+id+]~]" title="Show [+pagetitle+]">[+pagetitle+]</a>
</div>
[/tt]
IS THIS A BUG OR AM I DOING SOMETHING WRONG????
I must say that the same problem occured sometimes when i was calling some snippets (of mine) in the content of the page
Does anybody knows anything about it or shall i start debugging?????
-
MODX Staff
- 10,725 Posts
Ditto placeholders are not MODx placeholders and are processed by Ditto. This is what you are experiencing.
Thanks for answering so fast
But i still don’t get it why with two calls works and with one does not.
And besides I’m experience almost the same problem when I’m using some of my snippets.
When I call:
return $output; (in the snippet)
I have two call two times the snippet to get the output
Have you encountered such a behavior before?
I’m not sure but &hiddenFields=`Category` does not work ?
Listen guys there is a small confusion of how modx executes snippets an placeholders. I found a very good artickle in the wick.
Nevertheless i’m a bit confussed
Is there a difference between:
[[snippet]]
and
[[snippet?]]
Because it works different sometimes...something to do with the cache
Does anybody knows why?