English 中文(简体)
如何在使用单元_invoke()的整块中检索母页数的元数字?
原标题:How to retrieve parent page s $node variable in a block using module_invoke()?

I m 采用module_invoke() ,以包括一个编组,我需要在这个栏中读到我的母体内容页中所载的数值。 因此,我如何能够在我的栏目中找到<代码>Node变量?

使用Im:

<?php
    $block = module_invoke( my_blocks ,  block ,  view , 7);
    print $block[ content ];
?>

现在,我需要查阅<代码>Nonode in “my_blocks”,变量是空的。 我能做些什么?

感谢很多帮助!

关于

最佳回答

几乎没有固定办法:


    function InMODULE_or_InTHEME_get_current_node() {
      if ((arg(0) ==  node ) && (is_numeric(arg(1))) && (!arg(2))) return node_load(arg(1));
      return null;
    }

<Comments: node_load cache nodes, so una t worry about perfomance.
,“!arg(2)”正在检查你是否在 no(或某种情况)。

问题回答




相关问题
Drupal Multi-language: Simple strings not translated

I m adding additional languages to a Drupal site that I m building. Getting the translation of content working is fairly easy using the Internationalisation module. Yet, simple things such as date ...

Setting up a WYSIWYG editor for Drupal site users [closed]

Looking through the Drupal contrib modules, and after a few Google searches, it becomes evident that there are any number of choices and combos available to set up a WYSIWYG editor in Drupal. I m ...

Change size of user/password login box

I don t know how to change the size of the login username/password boxes on the drupal site that I m trying to build. I m stumbling through the theming, and don t know where to find the file that ...

How does Drupal provide an edit/review/publish model?

How does Drupal support a means to update and review a website before it is published? Does it only allow you to preview a page at a time before you publish it or is there a way to create a site ...

Term for rotating header

I m looking for terminology that describes this behavior: The header of a web-page contains a different image every time you visit it. Update: It is not an advertisement, but images related to the ...

Has anyone checked out Drupal 7? [closed]

Has anyone checked out a copy of Drupal 7 yet? What do people think? I m pretty excited about the PDO and all of the designers I work with a very excited about the new admin interface/structure. Do ...