2010-06-28 56 views
0

我有一個自定義內容(使用cck)即thewittyshit,它有一個字段field_thewittyshit。我想爲所有視圖主題field_thewittyshit字段。我寫了下面的代碼並將其保存在一個新文件中,即views-view-field-default -field-thewittyshit-value.tpl.php。但是仍然沒有任何變化反映在我的任何視圖或節點顯示中。在Drupal-6中構建字段

<?php 
// $Id: views-view-field.tpl.php,v 1.1 2008/05/16 22:22:32 merlinofchaos Exp $ 
/** 
* This template is used to print a single field in a view. It is not 
* actually used in default Views, as this is registered as a theme 
* function which has better performance. For single overrides, the 
* template is perfectly okay. 
* 
* Variables available: 
* - $view: The view object 
* - $field: The field handler object that can process the input 
* - $row: The raw SQL result that can be used 
* - $output: The processed output that will normally be used. 
* 
* When fetching output from the $row, this construct should be used: 
* $data = $row->{$field->field_alias} 
* 
* The above will guarantee that you'll always get the correct data, 
* regardless of any changes in the aliasing that might happen if 
* the view is modified. 
*/ 
?> 
<em> 
<?php print $output; ?> 
<em/> 

我想格式化文本。在這段代碼中,我只是使它以斜體顯示。

回答

1

您正在覆蓋的模板必須位於您的主題目錄中。在views模塊文件夾中找到views-view-field.tpl.php文件,並將其複製並粘貼到您的views-view-field--default--field-thewittyshit-value.tpl.php所在的主題目錄中。這應該讓你使用這個文件。確保在完成此操作後清除緩存。

出於調試目的,如果您仍有問題,請確保視圖使用views-view-field--default--field-thewittyshit-value.tpl.php。點擊「基本設置」部分下視圖UI中主題選項旁邊的「信息」。您正在使用的主題將以粗體顯示。