【发布时间】:2013-04-20 01:11:04
【问题描述】:
我在 Drupal 7 中使用 Tweet 模块。我需要用于打印 node-type.tpl.php 中的 tweet 字段的代码。不幸的是,我无法找到正确的代码来使链接出现在我的节点中。使用 contemplate 我找到了以下代码;
<?php echo $content['tweet']; ?>
<?php echo $content['field_tweet']; ?>
<?php echo render($content['tweet']); ?>
<?php echo render($content['field_tweet']); ?>
<?php print $node->content['body']['#object']->content['links']['tweet']['#theme'] ?>
<?php print $node->content['body']['#object']->content['links']['tweet']['#attributes']['class'][1]?>
<?php print $node->content['body']['#object']->content['links']['tweet']['#attributes']['class'][0]?>
<?php print $node->content['body']['#object']->content['links']['tweet']['#links']['tweet_Twitter']['html']?>
<?php print $node->content['body']['#object']->content['links']['tweet']['#links']['tweet_Twitter']['href']?>
<?php print $node->content['body']['#object']->content['links']['tweet']['#links']['tweet_Twitter']['title']?>
<?php print $node->content['body']['#object']->content['links']['tweet']['#links']['tweet_Twitter']['title']?>
但它们都不起作用。有人有什么想法吗?
【问题讨论】:
-
您是否尝试过
print_r($node)来了解结构?devel模块也会向您展示这一点。 -
嗨,我在 node-type.tpl.php 和节点本身的内容中都尝试了你的代码,但没有得到任何东西。
-
对node-type.tpl.php 文件的任何 更改是否会反映在站点上?您可能遇到了缓存问题,或者 node-type.tpl.php 甚至可能没有被使用。
-
是的,node--content-type-name.tpl.php 工作正常。只是没有显示
标签: php drupal-7 drupal-modules