I am trying to adapt a piece of theme code to my Zen subtheme. I think it should be very simple, but I can't work it out (newbie).

I am overriding a node-tpl.php with node-mynodetype.tpl.php successfully, and using it to make thumbnails popup in a Lightbox.
Using the code provided here: http://drupal.org/node/274487 at "Practical example".

Now I want to change this line of code:
$caption = check_plain($item['title']).' <br /> '. check_plain($node->title) .' PHOTO GALLERY. <br /> Use right and left arrows or the mouse to navigate';

to print not the title as caption, but the text in field_myfield. field_myfield is a CCK text field of this nodetype. When I leave the check_plain part in, I get a warning: "warning: preg_match() expects parameter 2 to be string, array given in ~/includes/bootstrap.inc on line 723."
When I leave check_plain out, the output is the text 'array' in stead of the text that is in the field. Anyone know what i should change here?

Comments

nevets’s picture

You probably want something like $node->field_myfield[0]['#value']. You can always add at the end of node-mynodetype.tpl.php the following to see the node structure.

<pre>
<?php print print_r($node, TRUE); ?>
</pre>
ar-jan’s picture

Yup I got it now, thanks!

$caption = check_plain($node->field_filefieldimage_caption_nl[0]['value']) .'

I should read up on php syntax, i've been hacking a lot without understanding :S