Forums / Developer / disable cache doesn't work
Emmanuel Averty
Tuesday 12 April 2011 7:56:39 am
Hi, In my eZ Publish site, I want a page showing its sub-elements with their own sub-elements count. For example : object1 : 3 elements object2 : 5 elements object1 and object2 are instance of a class I made (marque_non_classee). To override the line representing my object I added in my override.ini.append.php : [line_nom_nb_enfants] Source=node/view/line.tpl MatchFile=line/nom_nb_enfants.tpl Subdir=templates Match[class_identifier]=marque_non_classee And it works ! But if I move a sub-element of object1 to another place, the count doesn't change. So I added : {set-block scope=root variable=cache_ttl}0{/set-block} to nom_nb_enfants.tpl, but the children count still doesn't change. Is it a bug ?
Quoc Huy Nguyen Dinh
Wednesday 13 April 2011 8:46:27 am
From your Source=node/view/line.tpl I guess you are using {node_view_gui...} to load the line.tpl file inside a full view tpl file (override/template/full/myclass.tpl for example). In that case {set-block scope=root variable=cache_ttl}0{/set-block} won't work as the output of line.tpl is cached inside the cache of {myclass.tpl}
Add it to the calling tpl file as well, or use Ajax (jquery/yui) to fetch the numbers and still benefit of the view caching.
Thursday 14 April 2011 12:01:38 am
Thank you for your reply. You're right, I use node_view_gui. In fact, the calling template is the ezwebin basic folder template. I think I'll overwrite this template for this node in order to add {set-block scope=root variable=cache_ttl}0{/set-block}.
But, I don't understand what you mean about the Ajax method. Do you mean I can access eZ Publish objects through javascript ?
Monday 18 April 2011 3:20:55 am
I understood how to make an ajax fetching. Thank you for the idea.