I'm trying to add two tokens with php the following way:

<?php
$a=[token node node:profile_payment];
$b=[token node node:profile_payment2];
$c=$a+$b;
echo $c;
?>

This however doesn't work as php won't accept the token as replacement for a number. Does anyone know how I can do this as I really need this in a node for an invoice?

Comments

justingeeslin’s picture

With Input Formats (Text formats in D7), you can change the order the Filters are applied.

It looks like you need to 'Replace tokens' first and then do PHP Evaluation.

That seems possible with a new Input Filter with the Token Filter running first then PHP Evaluation.
I haven't tried that, but it seems possible.

(As a side note, it may be altogether better to preprocess the contents of this node to avoid having PHP in the node itself.)

darvanen’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Drupal 6 version is no longer supported. Please reopen this if you find it is relevant to Drupal 7 or 8.