自定义字段输出
我有一个名为“field_enroll_link”的字段。我想删除所有周围的 div 并只打印字段内容(它将进入锚标记的 href)。我创建了文件“field--field_enroll_link-course.tpl.php”和“field--field-enroll-link-course.tpl.php”,并将其放入我的模板文件夹中。它只包含 ,但是当我清除缓存甚至切换主题时,我仍然得到所有周围的 div 和标记。如何在 Drupal 7 中覆盖 field.tpl.php?
I have a field named "field_enroll_link." I want to remove all the surrounding divs and just print the field content (it will go into the href of an anchor tag). I created the files "field--field_enroll_link-course.tpl.php" and "field--field-enroll-link-course.tpl.php," and put it into my template folder. It just contained <?php print render($item); ?>
, but when I cleared the cached and even switched the themes, I'm still getting all the surrounding divs and markups. How do I override the field.tpl.php in Drupal 7?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在主题的 template.php 文件中定义此函数并清除缓存。我假设您已经安装了开发模块。
您
将能够访问您正在寻找的值。
In your theme's template.php file define this function and clear the cache. I am assuming you have devel module installed.
}
You will be able to access the value you are looking for.