Drupal 7: calling custom content type field into page tpl

cckdrupaldrupal-7drupal-theming

I'm working on a Drupal 7 website. I need custom layout for some pages. so I created page–customContentTypeName.tpl.php file and it addresses perfectly.

The problem is, I need to display some fields in page tpl. The code below works fine in node tpl, but page tpl :/

<?php print $content['field_images']['#items']['0']['filename']; ?>" />

How can I call custom fields into page tpl?

Appreciate helps!! thanks a lot!!


** SORTED **

with custom field editing… here is the tutorial video: http://lin-clark.com/blog/intro-drupal-7-theming-fields-and-nodes-templates#comment-54

Best Answer

For page.tpl.php if you access the node directly you can use $node variable

$node['field_images']['und'][0]['filename']

else use $page variable.

$page['content']['system_main']['nodes'][1]['field_images']['#items'][0]['filename'];

but remember in a page variable you might have more than one node.

Related Topic