【发布时间】:2011-07-22 19:07:28
【问题描述】:
在 Drupal 6 中,我向自定义内容类型添加了自定义字段。
名称是:“field_publishedin”
然后我在该字段中添加了一些示例文章的数据。
在它的视图中,我也添加了该字段。
在呈现它的页面上,我还添加了代码以显示该字段:
<div class="press-content">
<div class="family-news">
<?php foreach($rows as $row): ?>
<div class="news">
<div class="data">Posted on <a href="<?php print url('news/'.$row['created_1']) ?>"> <?php print $row['created'] ?></a> </div><!--DATA-->
<h4><?php print $row['title'] ?><span><?php print $row['field_publishedin_value']; ?></span></h4>
</div><!--NEWS-->
<?php endforeach ?>
</div>
</div>
所以我添加的代码是<span><?php print $row['field_publishedin_value']; ?></span>,因为根据在模板中使用时的视图,您应该添加“_value”。
但是,我点击了重新扫描模板,清空了 drupal 缓存,但新代码仍然没有呈现在页面上。
当我将此添加到页面时:<?php print '<pre>' . htmlentities(print_r($rows, 1)) . '</pre>'; ?> 并输出它未显示的可能数组值“field_publishedin_value”,因此模板似乎不知道该字段存在,即使它在视图中。帮忙?
【问题讨论】:
标签: drupal