Sunday, August 8, 2010

Customizing blog layouts

Nguồn: http://drupal.org/node/44699

Customizing how your blogs are displayed is extremely easy in Drupal using a phptemplate based theme. All you need to do is:

  1. Make a copy of your node.tpl.php file
  2. Rename it to node-blog.tpl.php
  3. in a text editor like notepad.exe or equivalent, edit the layout to suit your needs and upload it to your active theme folder
  4. Drupal will automatically pick up your new node-blog.tpl.php layout file and apply it

Available variables

  • $title : Title of node.
  • $node_url : Link to node.
  • $terms : HTML for taxonomy terms.
  • $name : Formatted name of author.
  • $date : Formatted creation date.
  • $sticky : True if the node is sticky on the front page.
  • $picture : HTML for user picture, if enabled.
  • $content : Node content, teaser if it is a summary.
  • $links : Node links.
  • $taxonomy (array) : array of HTML links for taxonomy terms.
  • $node (object) : The node object.
  • $main : True if the node is appearing in a context, like the front page, where only the teaser should be shown.
  • $page : True if the node is being displayed by itself as a page.
  • $submitted : Translated text, if the node info display is enabled for this node type.

Default template

print ($sticky) ? " sticky" : ""; ?>">
if ($page == 0): ?>

print $node_url ?>" title="print $title ?>">print $title ?>


endif; ?>
print $picture ?>

print $submitted ?>print $terms ?>


print $content ?>

if ($links): ?>

if ($picture): ?>


endif; ?>

endif; ?>

No comments:

Router Packet Networking

Đây là video ngắn khá hay, mô tả đường đi của một gói tin trên Mạng Internet.