[consulting] how to create token and use them in form text area

sidharth relhan sidhartharelhan at gmail.com
Thu Jun 17 17:35:39 UTC 2010


In my problem i have to store few variable as token like user name and user
id and use these variable in email body. Here email body is customize in
text area and saved as set variable. That is the reason i cant use token
filter.
I try to print

[user-name]
[user-id]
[user-mail]
[site-url]
[site-name]
these global variable thew can't show appropriate result
i use this function to get these variable
print_r(token_get_list($types = 'all'));



On Thu, Jun 17, 2010 at 10:39 PM, Travis Carden <travis.carden at gmail.com>wrote:

> You aren't just asking how to display a token in a node body, are you?
> Because if that's all you want, you can just use Token Filter<http://drupal.org/project/token_filter>module.
>
>
> On Thu, Jun 17, 2010 at 10:31 AM, Bhavin Joshi <bhavinjosi at joshics.in>wrote:
>
>> You can create your own token but you have to write a function or few
>> lines of code to replace them with the original values.
>> Like, you have to replace the values using t(<string>, array(tokens));
>> I use the same technique in some of my contributed modules.
>>
>> Regards.
>>
>> 2010/6/17 sidharth relhan <sidhartharelhan at gmail.com>
>> >
>> > Hello!!
>> > I stuck with a problem in creating and using token.
>> > I think that it is create using function hook_token_value()
>> > and using token_replace() function it replace variable but how to use
>> token in the body
>> > Example of creating token
>> >
>> > As in view they are called like [user].
>> > How to call them in the normal body if they are defined global.
>> > _______________________________________________
>> > consulting mailing list
>> > consulting at drupal.org
>> > http://lists.drupal.org/mailman/listinfo/consulting
>> >
>>
>>
>>
>> --
>> Bhavin H. Joshi
>> Mobile: +91 999 886 0979
>> Skype: bhavinjoshi19
>> google: bhavinjosi at joshics.in
>> Web: http://joshics.in
>> Get your tiny URL: http://ly2.in
>> Portfolio: http://sites.google.com/site/bhavinhjoshi/portfolio
>> _______________________________________________
>> consulting mailing list
>> consulting at drupal.org
>> http://lists.drupal.org/mailman/listinfo/consulting
>>
>
>
> _______________________________________________
> consulting mailing list
> consulting at drupal.org
> http://lists.drupal.org/mailman/listinfo/consulting
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/consulting/attachments/20100617/739d6fdc/attachment.html 


More information about the consulting mailing list