It took me a long time to figure out this simplest use of custom tokens after considerable searching, so I thought I'd drop my solution here. What I wanted to do was set up a global site variable that is easily editable in the Admin section by non-programmers. For example, say I wanted a list of keywords that any module, page, etc could access.

In the token admin I created a token called "token_custom_keywords"
The content of this token was:

print "good,nice,friendly";

Then anywhere else on the site I could access this as:

$myTokenString=token_replace("[token_custom_keywords]");

This works just as I wanted. Although if there's another module that does this in a more efficient way, I'd love to hear about it!

Comments

manuel.adan’s picture

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