tags:

views:

62

answers:

2

Hi, sorry, this is a really noob question...

When I want to print part of the $content array within node.tpl.php (for example), I'll use something like <?php print $node->content['body']['#value']; ?>

I just want to understand what the -> is all about. Presumably this indicates that $node is something other than a normal array? ( Otherwise it'd be $node['content']['body']['#value'] )

Cheers.

+5  A: 

$node is an object and content is one of its properties, containing an array.

If the contents of 'content' was also an object, it would be

$node->content->body etc.

Kevin
Not "items", the correct term is "properties" (as opposed to e.g. "dimensions", which are accessed with `[]`).
Artefacto
+1  A: 

Hi,

You should consider installing Theme Developer module. With it you can click on elements of your page, and you will get a debug list of all the Drupal or Views related variables which can be accessed by your code.

So you can explore $content, and all it's fields...

Scott
Theme Developer used to be part of the "devel" module, by the way, but is now its own project called "devel_themer"
Graham