view cache trouble

Author Message

Gabriel Ambuehl

Friday 09 December 2005 2:43:03 am

I'm wrestling with cache blocks in a full template for a certain node. Specifically, I want the cache to be based on url, user and a ezpreference parameter:

So I use

{array($uri_string,$current_user.contentobject_id, ezpreference('forumlook'))|attribute(show)}

in the template, but whenever I have view cache active, I always get

Attribute 	Type 	Value
0 	NULL 	
1 	NULL 	
2 	string 	$whateverwasselectedatlastcacheclean

My pagelayout doesn't have a cache block around module_result so I can't figure out why the above doesn't always get updated?` (If I disable the view cache, ezpreference will work but the two other strings still are even though the cache-block doc specifically mentions them to cache based on URI and user).

Visit http://triligon.org

Łukasz Serwatka

Friday 09 December 2005 2:54:11 am

Did you disable view cache for this template? Put in first line of this template file code

{set-block scope=global variable=cache_ttl}0{/set-block}

Then use cache-blocks.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Gabriel Ambuehl

Friday 09 December 2005 3:01:23 am

Of course, that's what I forgot.

It should DEFINITELY be noted on the cache-block doc page. ;)

Thanks, luke ;)

Edit: Remains the question as to why the two first params are null...

Visit http://triligon.org

Kristian Hole

Friday 09 December 2005 5:18:57 am

Remember that the $uri_string and $current_user is only avaiable in a pagelayout template, not in the node-view templates.

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Gabriel Ambuehl

Friday 09 December 2005 5:33:54 am

Ok, so I'll have to use other measures ;)

Visit http://triligon.org

André R.

Tuesday 16 October 2007 12:57:10 am

For future reference and since it doesn't seem to be documented, heres a list of the variable's that are supposed to be set in node templates:

$node (you should know this from before..  :)  )
$viewmode (the view mode, full, line, plain, etc.)
$language_code (the language code, probably added/updated around v3.8)
$view_parameters (the view parameters: limit, offset, custom stuff, etc.)
$collection_attributes (related to info collection)
$validation (probably related to info collection)
$persistent_variable (usually false)
$node_path (the node-path to a long and healthy life)

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.