
The use of extracting arguments in Drupal is a very powerful thing. Once you break down the Drupal path, you can customize practically everything. The path is the part after ?q= or /drupal_installation/. For example, adding a new comment ('add new comment') path for a page type is: comment/reply/10. arg(0) is comment, arg(1) is reply and arg(2) is the node nid. Once you wrap this path break down around your head, you can customize blog reply or story comment pages by cross referencing the node nid and its arguments to find out its ->type.
Below is a layout when someone visits your Drupal web site. First, Drupal loads its default template php file: page.tpl.php. In it are PHP if statements, determining what type of content is going to use which page layout template.
<?php if ( is_numeric(arg(1)) ){ /* for node/NID */ $nid = arg(1); }elseif( is_numeric(arg(2)) ){ /* for comment/reply/NID */ $nid = arg(2); } $node = node_load(array('nid' => $nid)); $drupaltype = $node->type; if ($is_front) { /* check if it's the front page */ include 'page-front.tpl.php'; /*load a custom front-page.tpl.php */ return; } if ($node->type == 'blog' || $drupaltype == 'blog' || arg(0) == 'month') { /* check if it's a blog node */ include 'page-blog.tpl.php'; /*load page-blog.tpl.php */ return; } include 'page-default.tpl.php'; /*if none of the above applies, load the page-default.tpl.php */ return; ?>