eZ Community » Forums » Extensions » Strange eZ Tags issue
expandshrink

Strange eZ Tags issue

Strange eZ Tags issue

Friday 10 June 2016 3:04:20 pm - 2 replies

Hi,

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.

Thanks,

Ryan

Modified on Friday 10 June 2016 3:12:03 pm by Ryan Krueger

Friday 10 June 2016 5:14:45 pm

Could it be a {cache-block} issue, where a variable is defined inside a cache block and is used outside of the cache block? Once that cache block is built, then the variable is no longer available?

Monday 13 June 2016 3:49:30 pm

Excellent thought!

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! 

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from