Drupal 7 - 查看主题字段 tpl
Drupal 7 - view theme field tpl
在 D7 中,我创建了一个视图并将其分配给一个块 (sidebar_first)。
我还在名为 - views-view-fields--categories--block.tpl.php
的主题模板文件夹中创建了一个视图字段 tpl
我想在无序列表 (UL / LI) HTML 结构中显示类别(结果)的名称。
有人可以帮助我吗?
下面是我放置代码时的数据print_r($row);
stdClass Object
(
[taxonomy_term_data_name] => Category 1
[taxonomy_term_data_vid] => 1
[tid] => 1
[taxonomy_vocabulary_machine_name] => categories
)
stdClass Object
(
[taxonomy_term_data_name] => Category 2
[taxonomy_term_data_vid] => 1
[tid] => 2
[taxonomy_vocabulary_machine_name] => categories
)
在字段 tpl 中,您将始终获得一行,但如果您在主题中使用 "display output" 命名约定创建 tpl:视图的信息,您将获得一个数组中的所有行。
您可以在其视图编辑页面 >> 高级选项 >> 主题信息中找到特定视图的主题信息
选择您网站使用的主题,然后在显示输出部分选择视图模板。
点击此处显示输出link后获取代码,复制粘贴到创建的tpl文件中。
现在在视图 tpl 中打印 $rows,您将在一个行数组中获得所有类别。
在 D7 中,我创建了一个视图并将其分配给一个块 (sidebar_first)。
我还在名为 - views-view-fields--categories--block.tpl.php
我想在无序列表 (UL / LI) HTML 结构中显示类别(结果)的名称。
有人可以帮助我吗?
下面是我放置代码时的数据print_r($row);
stdClass Object
(
[taxonomy_term_data_name] => Category 1
[taxonomy_term_data_vid] => 1
[tid] => 1
[taxonomy_vocabulary_machine_name] => categories
)
stdClass Object
(
[taxonomy_term_data_name] => Category 2
[taxonomy_term_data_vid] => 1
[tid] => 2
[taxonomy_vocabulary_machine_name] => categories
)
在字段 tpl 中,您将始终获得一行,但如果您在主题中使用 "display output" 命名约定创建 tpl:视图的信息,您将获得一个数组中的所有行。
您可以在其视图编辑页面 >> 高级选项 >> 主题信息中找到特定视图的主题信息
选择您网站使用的主题,然后在显示输出部分选择视图模板。
点击此处显示输出link后获取代码,复制粘贴到创建的tpl文件中。
现在在视图 tpl 中打印 $rows,您将在一个行数组中获得所有类别。