Skip to Content

template

creating a comment.tpl.php file

| | |

comment.tpl.php default code

<div class="comment <?php print ($comment->new) ? 'comment-new' '' ?>">
<?php if ($comment->new) : ?>

creating a node.tpl.php file

| | |

node.tpl.php in box_grey

We looked at page.tpl.php in box_grey which is a great, simple theme. It does have some limitations though:

  • Tables are still used for visual Layout
  • Structural tags are used strictly for clearing: <br class="clear" />
  • Some static title and alt values are explicitly set

The default node.tpl.php mark-up on the other hand is quite usable. It's not nearly as complex as far as structure goes because it does not require any mark-up for layout. It is just the content after all:

node.tpl.php Overview

| | |

Here's the official word from Drupal.org on node.tpl.php:

This template controls the display of a node, and a node summary.

View the Overview of node.tpl.php at Drupal.org

Node?

No really, what is a node? A node is an individual piece of content, so a blog post, a book page, a forum entry and an original CCK type entry are all nodes. So node.tpl.php is the template file that controls the display of nodes*.

box_grey_sans_tables

| | | |

Reviewing the box_grey page.tpl.php

We just looked at the the page.tpl.php file from box_grey. For the most part, the mark-up in the box_grey theme makes a very good base to build your theme upon. The file is not without it's faults though:

PROs

  • External styles are used in lieu of Inline styles
  • DIVs with logical ID and CLASS values are used for styling purposes
  • PHP logic is used to show elements only if they are enabled

CONs

  • Tables are still used for visual Layout
  • Structural tags are used strictly for clearing: <br class="clear" />
  • Some static title and alt values are explicitly set

We created box_grey_sans_tables or Sans to overcome some of the limitations of box_grey.

Syndicate content