Closed (fixed)
Project:
Drupal core
Component:
theme system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Jul 2005 at 16:59 UTC
Updated:
7 Oct 2005 at 06:40 UTC
Jump to comment: Most recent file
I've wondered why $node is not defined anymore in my theme's page.tpl.php.
The reason is a modified expression in phptemplate.engine, which now reads:
if ((arg(0) == 'node') && is_int(arg(1))) {
arg(1) may be the node number, but it is a string variable, and therefore this check is always false.
is_int should be replaced with the code given in the patch.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | phptemplate-is_int.patch | 739 bytes | Robrecht Jacques |
| phptemplate_node.patch | 720 bytes | wiz-1 |
Comments
Comment #1
Robrecht Jacques commentedRerolled the patch (and changed the coding: eg Drupal uses "&&", not "and"). I think wiz is correct: you should use "is_numeric" here, not "is_int".
Comment #2
Dave Cohen commentedConsider: if (arg(1) && ctype_digit(arg(1)));
reportedly performs better than is_numeric(), and true only for integers.
Comment #3
dries commentedCommitted to HEAD.
Comment #4
(not verified) commentedComment #5
(not verified) commented