Node.tpl.php |


This template controls the display of a node, and a node summary. It can only affect the output of the $content variable.

Available variables

Node content, teaser if it is a summary.
Formatted creation date.
The directory the theme is located in, e.g. themes/garland or themes/garland/minelli.
The sequential ID of the node being displayed in a list.
True if the front page is currently being displayed.
Node links.
$main (4.6)
True if the node is appearing in a context, like the front page, where only the teaser should be shown. No longer used in 4.7 and later.
Formatted name of author.
$node (object)
The node object. To view all of the properties of a current $node object, put the following line of code in your node.tpl.php: <pre><?php print_r($node); ?></pre>
Link to node.
True if the node is being displayed by itself as a page.
HTML for user picture, if enabled.
True if the node is sticky.
Author and create date information, if the node info display is enabled for this node type.
$taxonomy (array)
array of HTML links for taxonomy terms.
Boolean to indicate whether to return the teaser rather than the full node text.
HTML for taxonomy terms.
Title of node.
Alternates between odd/even in a list.

Tips: Print out available variables

Print the variables array

print '<pre>';

Print the variables array with the HTML markup

print '<pre>';
htmlspecialchars(print_r(get_defined_vars(), TRUE), ENT_QUOTES);

Default template for 5.x

<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?> clear-block">

<?php print $picture ?>

<?php if ($page == 0): ?>
  <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>

  <div class="meta">
  <?php if ($submitted): ?>
    <span class="submitted"><?php print $submitted ?></span>
  <?php endif; ?>

  <?php if ($terms): ?>
    <span class="terms"><?php print $terms ?></span>
  <?php endif;?>

  <div class="content">
    <?php print $content ?>

if ($links) {


Node.tpl.php |

Blogged with the Flock Browser


Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:


Vous commentez à l'aide de votre compte Déconnexion /  Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion /  Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion /  Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion /  Changer )

Connexion à %s

%d blogueurs aiment cette page :