Forums / Developer / Another v. 3.2-2 related issue
Eirik Alfstad Johansen
Tuesday 21 October 2003 5:59:14 am
Hi again,
I'm experiencing yet another mysterious problem after having upgraded to 3.2-2. In my pagelayout.tpl, I have the following template code which is supposed to display a specific code block if the user is viewing the main page (node #2).
{switch name=Sw1 match=$node.node_id} {case match=2} {* SOME CODE *} {/case}{/switch}
The problem is that the code isn't displayed when the node id equals 2. Well, it is, but only once and that's after I've cleared the content cache. Then, if I reload the page, the code block disappears again.
Does this make any sense to anyone?
Sincerely,
Eirik JohansenNetmaking AS
http://www.netmaking.no/
Sincerely, Eirik Alfstad Johansen http://www.netmaking.no/
Hans Melis
Tuesday 21 October 2003 2:23:18 pm
AFAIK, $node is not available in pagelayout templates when you're using viewcaching.
What I use in pagelayout templates (and it works with caching) is $module_result.node_id
If you do {$module_result|attribute(show)}, you'll find even more interesting variables. And if you really need the node itself, instead of just the ID, you can always do a fetch('content','node', hash(node_id, $module_result.node_id))
hth
--Hans
Hans http://blog.hansmelis.be
Wednesday 22 October 2003 12:41:01 am
Hi Hans,
Thanks a lot for the tip. I don't know why it worked using $node_id in the previous version, but the $module_result was eactly what I needed to get it working in in 3.2-2.
Thanks again !