node body
tokens in node body
public
group: Tokens
cwarden - Thu, 2008-05-29 23:27
What's the proper way to replace tokens within a node body?
I've created a simple module that implements hook_token_values and
hook_token_list, but to use my token within a node body, I've had to
implement hook_nodeapi, which doesn't seem right.
<?php
function mymodule_nodeapi(&$node, $op, $a3 = null, $a4 = null) {
if ($op == 'alter') {
$node->body = token_replace($node->body);
}
}
?>How about within a template? Is this discouraged?
<?= token_replace('[my-token]') ?>
