tokens

Does module exist to let site editors maintain own tokens and replacement text?

alaken's picture
public
group: Tokens
alaken - Thu, 2008-06-19 19:30

I really love token module! I'm especially loving it in pathauto and auto nodetitles - very powerful.

Is there a module to permit site editors to create and maintain their own tokens and corresponding replacement text, either through a UI or in a text file?

The site I'm building needs to let editors store snippets of text which can be reused in many places. For instance we might have this in node content: "McDonalds has sold [num_bugers_sold] in their history". We'd need a way to edit the value for [num_bugers_sold] and have that token update wherever it's used.


tokens in node body

cwarden's picture
public
group: Tokens
cwarden - Thu, 2008-05-29 23:27

What's the proper way to replace tokens within a node body?
I've created a simple module that implements hook_token_values and
hook_token_list, but to use my token within a node body, I've had to
implement hook_nodeapi, which doesn't seem right.

<?php
function mymodule_nodeapi(&$node, $op, $a3 = null, $a4 = null) {
   if (
$op == 'alter') {
     
$node->body = token_replace($node->body);
   }
}
?>

How about within a template? Is this discouraged?

<?= token_replace('[my-token]') ?>

Barcelona Event

greggles's picture
public
group: Tokens
greggles - Sat, 2007-08-04 14:54

Following Dries' request for more presentations I decided that Token module would be a good topic:

Token Module: How I Learned To Use the Token API and Stop Re-Implementing Dynamic String Replacement

So, if you are headed to Barcelona and want to learn more about using Tokens, this would be a great session to attend. Similarly, we plan to use some of the time to talk about the "future of tokens" which should hopefully be a useful topic.


Confirmation email token issue

public
teleute@drupal.org - Wed, 2007-04-04 07:46

Alright, I believe I know how to do some formatting (although I haven't done much yet, but I know it's working), and my custom cc processing module seems to be working. Ouch! My brain is melting. What a way to get my feet wet in the Drupal waters!

Anyway, two (hopefully!) final questions:

Syndicate content