Last updated October 12, 2010. Created by m1mic on October 21, 2004.
Edited by silverwing, andrevock, ronald_istos, Jeff Burnz. Log in to edit this page.
This template controls the display of a node, and a node summary. It can only affect the output of the $content variable.
Available variables
- $content
- Node content, teaser if it is a summary.
- $date
- Formatted creation date.
- $directory
- The directory the theme is located in, e.g. themes/garland or themes/garland/minelli.
- $id
- The sequential ID of the node being displayed in a list.
- $is_front
- True if the front page is currently being displayed.
- $links
- 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.
- $name
- 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> - $node_url
- Link to node.
- $page
- True if the node is being displayed by itself as a page.
- $picture
- HTML for user picture, if enabled.
- $sticky
- True if the node is sticky.
- $submitted
- 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.
- $teaser
- Boolean to indicate whether to return the teaser rather than the full node text.
- $terms
- HTML for taxonomy terms.
- $title
- Title of node.
- $zebra
- Alternates between odd/even in a list.
Available variables for 6.x
Drupal API documentation: http://api.drupal.org/api/drupal/modules--node--node.tpl.php
Tips: Print out available variables
Print the variables array
<?php
print '<pre>';
print_r(get_defined_vars());
print '</pre>';
?>Print the variables array with the HTML markup
<?php
print '<pre>';
print htmlspecialchars(print_r(get_defined_vars(), TRUE), ENT_QUOTES);
print '</pre>';
?>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>
<div class="content">
<?php print $content ?>
</div>
<?php
if ($links) {
print $links;
}
?>
</div>Default template for 4.7
<div class="node<?php if ($sticky) { print " sticky"; } ?><?php if (!$status) { print " node-unpublished"; } ?>">
<?php if ($page == 0): ?>
<h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>
<?php print $picture ?>
<div class="info"><?php print $submitted ?><span class="terms"><?php print $terms ?></span></div>
<div class="content">
<?php print $content ?>
</div>
<?php if ($links): ?>
<?php if ($picture): ?>
<br class='clear' />
<?php endif; ?>
<div class="links"><?php print $links ?></div>
<?php endif; ?>
</div>
Comments
Реально пишет автор, такие
Реально пишет автор, такие тематические статьи довольно интересно прочесть.
Thank you, you've been very
Thank you, you've been very helpful
Скачать fb2 книги Иоганна Гёте бесплатно или прочитайте книги немецкого поэта read.inolib.org в библиотеке Инолиб.