Noob issue: Token replacements not available in PHP
I am using the Token module for the first time. I am trying to use a replacement value from token in a page template. Since I have no idea how to do this, I inserted the the following code into my page.tpl.php:
<?php print_r(token_get_values($type = 'node', $object = NULL)); ?>And I get the following output:
stdClass Object
(
[tokens] => Array
(
[0] => user-name
[1] => user-id
[2] => user-mail
[3] => site-url
[4] => site-name
[5] => site-slogan
[6] => site-mission
[7] => site-mail
[8] => site-date
[9] => nid
[10] => type
[11] => type-name
[12] => language
[13] => title
[14] => title-raw
[15] => author-uid
[16] => author-name
[17] => author-name-raw
[18] => author-mail
[19] => author-mail-raw
[20] => menu
[21] => menu-raw
[22] => menupath
[23] => menupath-raw
[24] => menu-link-title
[25] => menu-link-title-raw
[26] => term
[27] => term-raw
[28] => term-id
[29] => vocab
[30] => vocab-raw
[31] => vocab-id
[32] => lnid
[33] => bookpathalias
[34] => termpath
[35] => termpath-raw
[36] => termalias
)
[values] => Array
(
[0] => first-admin-user
[1] => 1
[2] => myemail@host.com
[3] => http://www.site.com
[4] => Test Site Name
[5] =>
[6] =>
[7] => myemail@host.com
[8] => Fri, 05/15/2009 - 18:37
[9] =>
[10] =>
[11] =>
[12] =>
[13] =>
[14] =>
[15] =>
[16] =>
[17] =>
[18] =>
[19] =>
[20] =>
[21] =>
[22] =>
[23] =>
[24] =>
[25] =>
[26] =>
[27] =>
[28] =>
[29] =>
[30] =>
[31] =>
[32] =>
[33] =>
[34] =>
[35] =>
[36] =>
)
)The value that I need specifically is 'lnid', provided by the Type-local nids module, and it is missing in the output. But I see that many other "essential" values are missing in this list, such as 'nid', 'type', 'language', or 'title'.
According to some forum topic, I tried lowering the module weight of Token and/or Type-local nids using the Utility module, but the values are still missing.
Someone knows what I have to do in order to get these missing values?
Or maybe someone can tell me how to "use" token values inside a page template? (There seem to be many other users with similar problems.)

you forgot to fill the
you forgot to fill the $node/object
<?php
$nid = 123;
$node = node_load($nid);
print_r(token_get_values($type = 'node', $node));
?>
----------------------------------------
Jabber-me: dwehner@im.calug.de
Thanks, that works!
Thank you, Daniel, that does the job! Now, I have all the necessary values:
<?php print_r(token_get_values($type = 'node', $node)); ?>For the record: I found out that in my particular case with the Type-local nids module, it is not necessary to use the token. There is a variable, that holds the right value:
<?php print $node->lnid; ?>Thanks
Thank you so much, guys.
This is exactly what I needed as well. Much appreciated :)
- J
JayKayAu