简体   繁体   English

在Drupal 6模板中打印字段

[英]Printing a field in a Drupal 6 template

I believe the currently accepted form for printing a field in a Drupal 7 template is print render($content['field_name_here']); 我相信当前在Drupal 7模板中用于打印字段的表单是print render($content['field_name_here']);

However, I believe this was changed from something else in Drupal 6, and I cannot find documentation - how do I print a particular field value in a Drupal 6 template? 但是,我认为这与Drupal 6中的其他内容有所不同,并且找不到文档-如何在Drupal 6模板中打印特定的字段值?

Not sure if this is what you're looking for. 不知道这是您要找的东西。 Are you looking for the drupal_render function? 您在寻找drupal_render函数吗?

https://api.drupal.org/api/drupal/6 https://api.drupal.org/api/drupal/6

You can always print your fields from the $node variable (assuming this is a template for a type of content). 您始终可以从$ node变量中打印字段(假设这是内容类型的模板)。 Typically, it would be structured: 通常,其结构如下:

<?php print $node->your_field_name[0]['value']; ?>

You can see what variables are all available by simply doing a: 您只需执行以下操作即可查看哪些变量均可用:

<?php print_r ($node); ?>

and looking at the output. 并查看输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM