$node not available when viewCaching is enabled?

$node not available when viewCaching is enabled?

Friday 04 July 2003 8:46:17 am - 9 replies

Author Message

Jerry Jalava

Friday 04 July 2003 10:14:13 am

Hi Sven,

$node is not available when you use viewCaching, but you can use this instead: {$module_result.node_id}

Regards,
Jerry

Sven Ryen

Friday 04 July 2003 12:19:27 pm

I also need to access the parent of a node. Can that be achieved through $module_result.node_id?

Tony Wood

Friday 04 July 2003 12:24:15 pm

Hi Sven,

Try adding the following to your tpl, its really handy for finding out what variables are available.

<br>module_result.content
{$module_result.content|attribute(show, 1)}
<br>DesignKeys:used
{$DesignKeys:used|attribute(show, 1)}

I hope this helps

--tony

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Paul Forsyth

Monday 07 July 2003 2:40:55 am

If you know the node id then you can run a 'fetch' using it to get the real node and its parent.

It would be better if the whole business with DesignKeys and caching was resolved. It is very confusing having to consider when variables are available and when they are not.

Ez, plans to improve this?

paul

Karsten Jennissen

Monday 07 July 2003 3:00:05 am

I added a page to the new open documentation to reflect this. If you find things out / know more (I am not into the topic), could you please add details to the following pages:

http://ez.no/developer/ez_publish_3/documentation/customization/templates/caching/variables_in_cached_templates
http://ez.no/developer/ez_publish_3/documentation/customization/templates/caching

Regards,
Karsten

Valentin Svelland

Monday 29 September 2003 3:09:41 am

This thread was very useful, but I still can't fetch out the published date of my nodes when turning on cache..

This is the original code working when not cahced:
{$node.object.published|l10n(datetime)}

Tried this, but it won't work:
{$module_result.node.object.published|l10n(datetime)}

Please, anyone know the solution to this cache-problem?

(My eZ version : 3.1-1 Revision: 2703 )

Shurbann Martes

Monday 29 September 2003 3:26:41 am

Shouldn't this be:

node_id instead of node

Good luck,
Shurban

Valentin Svelland

Monday 29 September 2003 3:35:04 am

Well, this still doesn't work when cached..
({$module_result.node_id.object.published|l10n(datetime)})

All my code:

{let article_list=fetch('content','list', hash(parent_node_id,$module_result.node_id,
sort_by,$module_result.node_id.sort_array,
offset, $view_parameters.offset,
class_filter_type, 'include',
class_filter_array, array( 2 ) ))
}
{section name=bottomlist loop=$article_list max=50 offset=8}
<li><a href={concat("/content/view/full/", $bottomlist:item.node_id, "/")|ezurl}>{$bottomlist:item.name|wash}</a>
( {$node.object.published|l10n(datetime)})</li>

{/section}</ul>
{/let}

Paul Forsyth

Monday 29 September 2003 3:03:28 pm

Remember that node_id is just a number. Take a look at this article:

http://ez.no/content/view/full/32420

so to get your node you still need to fetch it:

{let my_node=fetch(content,node,hash(node_id, $module_result.node_id))}

Now you can use it as you expect:

{$my_node.object.published|l10n(datetime)}

Paul

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

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