Use tokens in PHP filter i want make a photo gallery with drupal and i need to:


a download button for current node picture
an embed code that allow visitor to use photo on other Websites. like this:



i have some experience with Drupal and reading PHP codes, but no experience with writing PHP codes. i tried to make a block in bottom of node picture with PHP filter and following content:

&lt;pre&gt;&lt;a href="&lt;?php t('[node:url]'); ?&gt;" title="&lt;?php t('[node:title]'); ?&gt;"&gt;&lt;img src="&lt;?php t('[node:field_image]'); ?&gt;"&gt;&lt;/a&gt;&lt;/pre&gt;


this code not work. please help me.

many thanks :)
To translate the tokens in their values, you can use:

token_replace

e.g:

$nid = token_replace('[node:nid]', array('node' =&gt; $node));


You need to be able to pass the required parameters for that token, e.g $node for node tokens.