Really Simple Example/Documentation

Created on 12 August 2011, over 13 years ago
Updated 15 December 2024, 3 days ago

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!

πŸ’¬ Support request
Status

Active

Version

1.0

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States graemerae

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024