What's "the Drupal way" to do this (dynamic content in a Page)?
This is a follow up question of How to get URL argument in Page body by PHP? .
Objective: Site content editor needs to show dynamic content, based on a URL parameter, i.e.:
URL:
http://example.com/node/1?Name=John
In Page node:
<?php if (isset($_GET['Name'])) { ?>
<?php print "Dear " . $_GET['Name'] . ","; ?>
<?php } else { ?>
Hello,
<?p开发者_C百科hp } ?>
blah blah blah ...
You may imagine the URL is from a link inside an EDM message. Both the EDM message and the Page content is maintained by the same content editor.
So, what is the Drupal way to archive this?
You could create a module that extends the functionality of the token module to allow for the use of the various _GET variables as tokens in the body. The code to make the tokens available isn't a big deal, and using the token filter module below would make it simple for the editor to use the values in the node body.
http://drupal.org/project/token_filter
精彩评论