[drupal-support] $node not always available
Gerhard Killesreiter
killesreiter at physik.uni-freiburg.de
Wed May 4 10:28:28 UTC 2005
On Tue, 3 May 2005, Maykel Moya wrote:
> I recently asked for a way to know the current viewed node, someone
> point me to global $node. The problem is that the variable is
> randomly available, sometimes it have the correct content, sometimes
> is empty.
>
> This is probably a bug of Drupal core. I'm using CVS HEAD.
No, this is by design. $node is not a global variable.
> I'm thinking using global $_menu['local tasks'] and do some tricky
> parsing to find out the current viewed node.
You can parse the url instead (arg(0) == 'node' && is_numeric(arg(1))).
Cheers,
Gerhard
More information about the drupal-support
mailing list