Forums / Developer / Caching problem.. / Comment46824

Author Topic

Claudia Kosny

Tuesday 19 September 2006 12:28:46 pm

Comment46824

Hello David

I think there is a bit of confusion here so I'll try to clarify a bit:
It is not possible to use $node in the pagelayout.tpl. If you want to use it there you have to fetch the node again by using $module_result.node_id (which will only be filled if you are viewing a node).

If you use another template using $node should work just fine provided there is a node to view (no matter what the cache settings are). Every item you can see in the treemenu in the admin view is such a node. When you call up a template for such anode EZ fills the variable $node with the information about this item. An example for a template which does not have a node is the basket (or the confirmorder, I forgot).

So if your code is part of the pagelayout you have to use $module_result.node_id (as far as I know there is no variable $pagelayout_node.node_id).
If it is in a separate template I am wondering now how you call up this template. Do you include it from within another template? Please elaborate on that if this is the case.

Now to the problem with the pagination: At the beginning of you code insert the line

{$view_parameters|attribute('show', 2)}

This will show you the content of the view_parameters variable. Does offset have a value in there? Depending on how you call up the template the view parameters might not survive. This happesn especially if you include this template in another template as in this case the other template recieves the view parameters and has to relay them to the included template (check the doc for include if necessary).

Regarding the image problem:
Normans code displays the image of $element, not of the first child. So you might want to try this:

{attribute_view_gui attribute=$element.children[0].data_map.image
 href=$element.children[0].url_alias|ezurl()}

Although please note that the children array of a node might not be sorted according to whatever sort order you have defined for this node. If the sort order matters you have to fetch the first child node using the fetch function as you can sort there.

So if the problems persist please tell us
- in which template is the code is gave us?
- how do you call up this template? (best give the precise codeline and/or an example url)
- what is the content of $view_parameters if you use the pagination?
- are there any interesting infos in the debug output?
- whatever interesting info you come up with

Greetings from Luxembourg

Claudia