Friday 10 June 2016 3:04:20 pm - 2 replies
I've encountered a strange issue that has to do with the eZTags functionality and possibly how it relates to caching. We are running eZPublish 4.7.0.
Basically, in my head.tpl template file I'm dynamically building the title tag based on the specific tag for that page. The tag id is passed in the url so I'm able to retrieve the tag id using $view_parameters.
Once I have the tag id I do my fetch for the tag exactly as follows:
$variable = fetch(tags, tag, hash('tag_id',$tag_id))
From there I extract the keyword attribute, assign it to a variable, and use it as the tag name and append that to my title tag.
All of this works wonderfully...for a time. After a period of several hours the logic stops working and the title tag is not built at all. There is only one cronjob that runs hourly during the day and it basically recreates a custom table of our products. I have determined this job is not the culprit.
The only way I am able to resolve the issue is by clearing the content cache. Once I clear that cache it will work for another several hours until it breaks again. One thing worth mentioning is that we're doing a fetch for tags in the content_page.tpl template in the exact same fashion and renders after head.tpl, however that logic has never broken to my understanding. Also, with caching disabled in our dev environment, the logic never fails.
It doesn't seem to add up but it seems to somehow be related to the content cache? What could be occurring after a period of time that might be breaking the logic but not affecting the nearly identical logic in a template file that renders after the head.tpl template?
I'm open to any ideas.
Modified on Friday 10 June 2016 3:12:03 pm by Ryan Krueger
Monday 13 June 2016 3:49:30 pm
Based on that thought, I investigated the cache-block behavior more closely and specifically it's behavior when used in pagelayout.tpl. In that template file I have a cache-block defined which then calls my head.tpl template in which I'm defining my title tags.
I discovered that the reference for $view_parameters is different in the pagelayout.tpl template and should rather be $module_result.view_parameters. This had never occurred to me because it was never an issue for my dev environment which makes me think the difference falls within the cache behavior.
I'm still not entirely sure as to the why or how, but once I identified that my trigger was the cache for the cache-block being invalidated, I was able to approach the issue more scientifically. If I'm missing something obvious, please let me know.
Thanks for your help!
You must be logged in to post messages in this topic!