Drupal - 显示块内节点的标题

发布于 2024-08-25 19:12:31 字数 182 浏览 3 评论 0原文

我需要动态显示块内节点的标题。我本以为这很简单,但我尝试过的所有代码片段似乎都不起作用(例如 title; ?>

我已经检查并测试了 PHP 输入格式是否已打开并与其他 PHP 位和 bob 一起工作,一切似乎都正常。

有什么想法吗?

I'm needing to dynamically display the title of a node within a block. I would have thought this would be simple, but all the code snippets I've tried don't seem to work (e.g. <?php print $node->title; ?> )

I've checked and tested that the PHP input format is on and working with other PHP bits and bobs, and everything seems OK.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

绝對不後悔。 2024-09-01 19:12:31

我认为此链接可能会有所帮助:

http://www.g-loaded.eu/2009/05/07/drupal-tip-list-a-nodes-taxonomy-terms-inside-a-block/

基于此:

if ( arg(0) == 'node' && is_numeric(arg(1)) ) {
    $node = node_load(arg(1));
    echo $node->title
}

I thik this link might be of help:

http://www.g-loaded.eu/2009/05/07/drupal-tip-list-a-nodes-taxonomy-terms-inside-a-block/

Based on it:

if ( arg(0) == 'node' && is_numeric(arg(1)) ) {
    $node = node_load(arg(1));
    echo $node->title
}
软糯酥胸 2024-09-01 19:12:31

还可以选择使用 Views 模块来实现此目的。

There is also the option to use the Views module for this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文