Forums / General / error only in cached template

error only in cached template

Author Message

j jevack

Wednesday 18 January 2006 9:25:27 am

Greetings All,

I'm experiencing an odd problem: the template executes correctly when the cache is cleared. However when ezp runs the cached template, it throws an error.

error:
array_keys(): The first argument should be an array in /usr/local/apache2/htdocs/ez_rmu/var/plain/cache/template/compiled/content_business_home-e9b6c83fd17eba0ede6f52b6b730178a.php on line 1368

if it'll help here's the code:

{let department_schools=fetch(content, list, hash(parent_node_id, $node.node_id))}
	{foreach $department_schools as $school}
	  {if $school.object.class_name eq('Page')}
		
		<A HREF={$school.url_alias|ezurl}><IMG SRC={"/images/general_pointer.gif"|ezdesign} width=20 height=11 border=0 vspace=3></A>

		<A HREF={$school.url_alias|ezurl}>{$school.name}</A>

	   {/if}
	 {/foreach}
{/let}

Thanks in advance,

Jason

j jevack

Wednesday 18 January 2006 12:44:41 pm

I fixed the problem and I think it was using $node variable in a page layout template. When I replaced the $node.node_id variable in the first line with $module_result.content_info.node_id everything works fine.

Is this because $node is only available in a content view? Why would it work when not cached and only have problems when executing a cached template?

Thanks

Jason

Esteban Rodriguez

Wednesday 18 January 2006 1:16:02 pm

Thats exactly the problem, $node is not available outside $module_result and you notice it when the cache is turned on.

Check this page out, its quite handy:
http://ez.no/doc/ez_publish/technical_manual/3_6/templates/the_pagelayout/variables_in_pagelayout

I have great faith in fools; self-confidence my friends call it.

http://presencia.net

j jevack

Thursday 19 January 2006 3:40:25 am

Thanks for the explanation Esteban. That makes sense.