English 中文(简体)
How do you separate the template of a blog block in Drupal?
原标题:

In Drupal, I created a block using views. This block contains the latest blog entries. I ve placed this on a specific page to display it as an archive. Now, as for the blog itself (for example when one of them is clicked), A blog template for it depends on node-blog.tpl.php. My problem is, when I style node-blog.tpl.php, the block I created for the archives (as it displays on the page) gets affected.

For example if I add TEST on node-blog.tpl.php, I will also get that on the block for every entry. I think it s because it is associated to a blog entry? What I want is to have node-blog styled "alone" when blog entries are viewed individually and not get the other entries on the blocks on the archive page be affected. How should I do this?

问题回答

In your view you are probably using the "node" row style. This means that each blog in your block view is displayed as a full node and will be affected by node-blog.tpl.php

The easiest way to fix this is to change row style to "fields" and select the individual fields to display in the view. Then you can individually theme each field using the view s custom .tpl.php files (you can click on Theme: Information in the view to see scanned tpl.php files).

Another way to fix this would be to select "teaser" build mode in the row style settings. Then in node-blog.tpl.php do something like the following:

if ($teaser) {
  //Display stuff for the block
}
else {
  //Display stuff for the full page
}




相关问题
drupal form textfield #default_value not working

I am working on a custom module with multi-page form on drupal 6. I found that #default_value is not working when my #type => textfield . However, when #type => textarea , it displays correctly ...

Syntax Highlighting in Drupal

Which is the best module for Syntax Highligting in Drupal. I am using GeSHi for syntax highlighting my code. It was working fine then I installed a second module FCKeditor. Now GeSHi filter is not ...

Conditional link to node within views?

I have two content types, book and chapter. Each chapter node contains a node reference of the book to which it belongs. I have created a view which displays the title of each chapter for a given ...

Foreach in SQL?

I m not quite sure how to do this in SQL. Here it is in pseudocode: Take the list of nodes with content type X. For each node, take the value of field Y. Insert into term_nodes VALUES ((tid that ...

Drupal section accessible by role

I need to limit access of content on Drupal site based on the Drupal User s Role. http://site.com/managers/intro http://site.com/managers/reviews http://site.com/managers/up-for-raises The ...

Ungroup user menu in Drupal

I am using Drupal 6.x with Zen theme. Currently, the following 3 user functions are grouped under a menu, when accessing urls like http://domain.com/user Create new account / Log in / Request ...

热门标签