【发布时间】:2015-06-12 11:00:23
【问题描述】:
我需要在我的 template.php 上检索 1 page.tpl.php 中的字段值。
在 page.tpl.php 中检索字段的正常方法是:
$field = field_get_items('node', $node, 'field_name');
$field_name = field_view_value('node', $node, 'field_name', $field[0]);
page.tpl.php 通常位于“sites\all\themes\themename\templates”目录中
template.php 文件位于“sites\all\themes\themename”目录下
我必须在 template.php 中的函数中提取 page.tpl.php 中的字段值。
任何人都可以提出一个适当的方法来做这件事,甚至给我一个可行的解决方案吗?
【问题讨论】:
标签: templates drupal drupal-7 drupal-nodes