-
☆ A M B ☆
- 24,524 Posts
The question mark is only needed if there are parameters; it works just like the query string in a URL.
Just quickly looking over the code, I think that that the problem here is that the placeholder is being cached (even though the snippet is not). So you’d either have to make the whole page uncached or have the snippet return the code that you are currently setting as a placeholder (i.e., the CSS font size declaration) and put the snippet in your template where you now have the placeholder. I guess you could also have another uncached snippet that returns the value of the placeholder, but that would really only make sense if the placeholder were set somewhere else (e.g., a plugin).
-
MODX Staff
- 730 Posts
@ZAP - wow, I didn’t even know that placeholders could get cached independent of the snippet that sets them. Is this documented somewhere? I didn’t mean to cause this much confusion with a little example snippet. I should definitely figure this out before I strike again ;-)
Quote from: netProphET at Dec 07, 2007, 12:14 PM
@ZAP - wow, I didn’t even know that placeholders could get cached independent of the snippet that sets them. Is this documented somewhere? I didn’t mean to cause this much confusion with a little example snippet. I should definitely figure this out before I strike again ;-)
I don’t know that it is documented, but it’s something that I’ve stumbled across over time (I say stumbled because I also assumed that they would always be uncached rather than cached). I think that placeholders are just treated the same as chunks when the document parser creates cache files, so they get cached on the first page load and then never change again unless you clear the cache. I’ve had to create uncached snippets that just return placeholder values in the past, and that’s worked for me.
If I’m using it well and, according to netProphET’s words, placeholders can’t be cached or uncached independently... Then, what is the reason of this?
Quote from: Pepest at Dec 10, 2007, 04:20 AM
If I’m using it well and, according to netProphET’s words, placeholders can’t be cached or uncached independently... Then, what is the reason of this?
You probably have the page uncached.
-
MODX Staff
- 730 Posts
Quote from: Pepest at Dec 10, 2007, 04:20 AM
If I’m using it well and, according to netProphET’s words, placeholders can’t be cached or uncached independently... Then, what is the reason of this?
Just to be clear, I was saying that I didn’t know that this could happen. Not saying it can’t happen. I’m still not sure about it.
I just noticed that this sticks a "1" in my <head> right before required <style> tag.
Any ideas?
Quote from: fruitwerks at Dec 10, 2007, 07:04 PM
I just noticed that this sticks a "1" in my <head> right before required <style> tag.
Does your snippet end with just return;? You should always return some value from a snippet to avoid seeing text like this (a 1 means the snippet was executed, afaik). Change it to return ’’; (an empty string).