$node->type and $node problems
strpos() returns the zero-based offset of the first occurrence of the test string. So if your string is article and the node type is article, it will return 0.

Your if statement is basically doing this check:

if (true == 0) { ...


Since 0 is a boolean FALSE in PHP the condition isn't satisfied, and the if construct is never entered.

There are a few ways you can change the if statement which basically boil down to the same thing:


if ($node-&gt;type == 'article') {
if (strpos($node-&gt;type, 'article') !== FALSE) {
if (strpos($node-&gt;type, 'article') === 0) {