Some background info: I'm Building a D7 module that also sends out a message to users of the site. I want the site maintainers to be able to define the message by using 'tokens' like this:
$string = "hello :username, there is a new node called :nodenodename_with_a_link on the :website"; // defined in the GUI
I could use str_replace to replace those 'tokens' like so:
$find = array(':username', ':nodenodename_with_a_link', ':website'); $replace = array($username, $node, $sitename); // generated form the db $newstring = str_replace($find, $replace, $string);
But I'm wondering if this is also the correct way to go in Drupal (7)?