Hey, I have a little problem with my current project.
I have image bound to each node of custom type and I need to change BODY background to this image after i view this node.
I know that i can do such thing with editing node-mycontent.tpl.php like this:

  <div class="content clear-block" style="background: #000 url(<?php print $node->field_image[0]['filepath'] ?>)  top right no-repeat">

but it dosen't work with page.tpl.php in BODY section eg.

 <body style="background: #000 url(<?php print $node->field_image[0]['filepath'] ?>  top right no-repeat">)

I would appreciate quick response. THX.

Comments

mist’s picture

Priority: Critical » Minor

I found rather brute force and leaky solution:

I use this code

<?php
	$nid =  $_SERVER['REQUEST_URI'];
	$nid   = (int)(ereg_replace("[^0-9]","",$nid));
	$my_node = node_load($nid, NULL, NULL);
?>

before BODY is build.

I will not work with friendly urls. Is there any other way to do it ?

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.