I’m trying to set a dynamic class when the total count of items in a pdoResources query exceeds a certain number. Normally on this slider i’m using the pagination buttons below it are hidden, but when the count is greater than 4, then buttons appear. I’m trying to adjust the height of the colored background of a similar slider using the same method by adding a class. But it’s not working for some reson.
I have the &setTotal set to 1 and &totalVar set to featInsightsTotal in my pdoResources query.
in my classes I have this: [[+featInsightsTotal:lt=5:then=noDeskPagination:else=``]]
I would think that when the total is less than 5, it’d use the class and when it is 5+ it wouldn’t. But for some reason it is using the class.
I know that it’s reading the count properly because [[+featInsightsTotal]] by itself is returning 5 and when I remove an event from the list, it reads as 4.
A cached snippet is only executed once.
When the cache is empty and someone makes a request to a resource, the cached snippets are executed and their result is written to the cache. All future requests return the same result, until the cache is cleared again.
An uncached snippet on the other hand is executed on every request.
Every time you change a resource or chunk or snippet etc. in the manager and click the “Save” button, the cache is cleared.
You need uncached snippets for example to handle user data. Let’s say you have a contact form on your page. The snippet that processes the sent form data has to be uncached, because the data is unique for every request.
If you have a page where the displayed data depends on the current time, then you have to use uncached snippets as well. Otherwise the displayed data stays the same, until the cache is cleared again.
Another point on uncached tags: Using the exclamation point can cause a delay in processing the tag. So an uncached tag inside an cached tag or page means that the results of the uncached tag may not be available when they’re needed.
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”.