I'm trying to create a teaser node template to display all Blog teasers. For the page tpl I have page-blogs.tpl.php For the Blog node tpl I have node-blog.tpl.php (This one is looping to display all the blog teasers) Now how do I create a node template to surround the node teasers? My URL for the page with all the blog teasers is: /blogs/eric My URL for the page with an example blog entry is: /blogs/eric/test-blog-1 I need a node template that I can use for all the Blog pages. I tried using node-blogs-teaser.tpl.php for the individual teaser nodes and node-blog.tpl.php for the outer blog node template, but that didn't work.
Here is what I have in my node-blog.tpl.php file:
<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">
<div class="item">
<ul>
<?php print $picture ?>
<?php if ($page == 0): ?>
<?php endif; ?>
<div class="content clear-block">
<li class="title"><h4><?php print $title ?></h4></li>
<li class="photo"><a href="#"><img src="/<?php print $node->field_blog_image[0]['filepath']; ?>" /></a></li>
<li class="desc"><?php print $node->content['body']['#value']; ?></li>
<li class="link">
<?php if ($teaser): ?>
<a href="<?php print $node_url ?>" class="block-link">Read more</a> | <a href="<?php print $node_url ?>" class="block-link">Audio/Video</a> |
<?php endif; ?>
<?php print $submitted; ?>
</li>
<div class="clear"></div>
</div>
<div class="clear-block">
<div class="meta">
<?php if ($taxonomy): ?>
<div class="terms"><?php print $terms ?></div>
<?php endif;?>
</div>
</div>
</ul>
</div>
</div>
thanks
UPDATE: I added a page preprocessor function in template.php :
/**
* Override or insert PHPTemplate variables into the templates.
* These are the main outer templates such as page.tpl.php
*/
function phptemplate_preprocess_page(&$vars) {
// add template hints using path alias
$alias = drupal_get_path_alias($_GET['q']);
if ($alias != $_GET['q']) {
$template_filename = 'page';
foreach (explode('/', $alias) as $path_part) {
$template_filename = $template_filename . '-' . $path_part;
$vars['template_files'][] = $template_filename;
}
}
//----
}