我正在嘗試創建一個傳情節點模板以顯示所有博客特技。 對於頁面tpl我有page-blogs.tpl.php 對於博客節點tpl我有node-blog.tpl.php(這是一個循環顯示所有的博客teasers) 現在我該如何創建一個節點模板圍繞節點戲弄者? 我與所有的博客玩笑的頁面的URL是:/博客/埃裏克 我的網頁與博客條目的例子是:/ blogs/eric/test-blog-1 我需要一個我可以使用的節點模板爲所有博客頁面。 我嘗試使用node-blogs-teaser.tpl.php作爲單獨的teaser節點,並使用node-blog.tpl.php作爲外部博客節點模板,但這並不奏效。博客傳情節點的節點模板
以下是我在我的節點blog.tpl.php文件:
<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>
感謝
更新:我加入的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;
}
}
//----
}
由於頂部亞倫。 我沒有循環任何東西,我試圖說我注意到node-blog.tpl.php正在用於每個節點傳情。所以在頁面/博客/ eric上,它似乎在爲每個傳情者調用tpl文件。我想要的是每個博客頁面上方的標準標題不重複。我想要這個博客預告頁面和博客整版頁面。 感謝您的幫助 – EricP 2010-08-23 19:02:31
什麼是/博客/埃裏克這是顯示博客條目列表?它是一個視圖或另一個模塊提供該頁面? – Aaron 2010-08-23 19:04:18
對於/ blogs/eric我有page-blogs.tpl.php作爲我的主要模板,它正在打印<?php print $ content?>。 我粘貼了我在node-blog.tpl中的內容。PHP文件在我原來的帖子。 我沒有使用任何意見。 – EricP 2010-08-23 19:09:14