Hi all,

i'm using this code within page.tpl.php to show the sidebar-inner div only with a special node type:

http://drupal.pastebin.com/m14ffdc9f

unfortunately this throws an error which i can't get rid of

here's the error: http://drupal.pastebin.com/m772f72c

any idea? (code works though but the error appears).

The error sometimes appears after hitting F5 (refresh) in the browser but doesn't appear when calling a page for the first time. It appears on nodes and within a view full of nodes.

Thanks for helping!

Comments

ainigma32’s picture

<?php if(arg(0) == "node" && is_numeric(arg(1))): ?>
		<?php node_load(); ?>
		<?php if($node->type == "news"): ?>
		<div id="sidebar-inner">
		 Werbung News
		</div>
		<?php endif; ?>
		<?php endif; ?>

Shouldn't you be passing some value into node_load() ?

See http://api.drupal.org/api/function/node_load/6

HTH

Arie

fhelmschrott’s picture

Of course, Arie - thanks for pointing to the right direction - works now with

<?php node_load(arg(1)); ?>

yelvington’s picture

Why are you explicitly loading the node object?

nevets’s picture

As the question suggests, $node is already set in page.tpl.php when viewing a single node.