Reputation: 16048
I'm working on a Joomla plugin which utilises the onPrepareContent()
event. However, I've determined that this event does not get dispatched if caching is enabled, and the content is cached (i.e. in cache/com_content
).
How can I act on the viewing of an article, even if the article is cached, and have the article data available? (I'm specifying that last condition because, otherwise, I could just use a system event - e.g. onAfterRoute() or similar)
Upvotes: 0
Views: 323
Reputation: 21
In Joomla 3.4.0, I tried using system events in a content plugin, and they do not fire when the content is cached; only once, when the page is first loaded and cached. After that, they do not fire again. I guess the content plugin only gets invoked when the page is being cached, whatever events it contains.
Upvotes: 0
Reputation: 5615
the idea behind cache is indeed that the data is retrieved once and served many times, so it will not be available anywhere during a cache load; so in your plugin you could access the database and load the article using a different event such as onAfterRoute(), but of course you're slowing down your site, and possibly an ajax browser based alternative could achieve the same purpose (which you haven't clarified).
An alternative is to force Joomla not to cache the article if you only desire to achieve this on a limited number of articles, but this would most likely require a core hack and it wouldn't be faster than using the plugin as I wrote above.
Upvotes: 1