Snippet in Snippet problem parsing

I have already encountered such a problem several times and let it go, but this time I want to find out what is causing the problem and maybe fix it.

Well, when linking several snippets I notice that there is an error with their parsing.

Now I have such a snippet, which is OK:

[[!buttonCircle? &href=`[[*event-google-map]]` &target=`_blank`]]

And if I put it in another snippet there is a problem


[[*event-google-map:isnot=``:then=`       
         [[!buttonCircle? &href=`[[*event-google-map]]` &target=`_blank`]]
`:else=``]]

What could be the cause? I am using MODX 3.0.5, PHP Version 8.1.29

What exactly is the problem?
Maybe don’t mix cached/uncached tags and try to call buttonCircle cached.
No reason to call it uncached.

Calling the inner tag uncached (with the exclamation point), delays its processing. That means the return value of the inner snippet won’t be available at the time the outer tag needs it.

1 Like

Thanks, that helped! That is, you can’t mix cached snippets with uncached snippets.

Well, you can, but it doesn’t always work the way you think it will. :wink:

Keep in mind that it’s usually faster and more reliable to write a custom snippet to do what you want. You can also use $modx->runSnippet() inside a snippet to run an other snippet and use the return value.

Either way, the cache is no longer an issue.

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.