PDA

View Full Version : pass $link.URL to my php code


akashif
09-11-2006, 01:34 AM
hi

i am trying to ad some calculations on link display and links clicks.
every thing is done . only bit left is $link.URL.

i am modifing the link.tlp

add my php function like

Content visible to registered users only.

it is not working
i checked the value with

Content visible to registered users only.
output is URL

then tried with

Content visible to registered users only.

it is giving some error and nohing is displaed on page

can any one advise me how can i pass a smarty varible to php

thanks

Ali Kashif

Boby
09-11-2006, 12:56 PM
You don't pass Smarty template variables back to the core PHP file. All you do is pass variables from the PHP file to the Smarty template. The second thing is you never call a function with $function(blah blah) you call it with function(blah blah)

A good way is to use your custom function in the PHP file, and pass the result as Smarty template variable:
Content visible to registered users only.
Then call the resulted variable in Smarty with:
Content visible to registered users only.

If you really want to use the {php} tag in Smarty, read first the docs:
http://smarty.php.net/manual/en/language.function.php.php

Content visible to registered users only.

Hope this helps more.

Boby

akashif
09-12-2006, 12:00 AM
hi

thanks Boby, i have already tried with {php}, and i am successfull in every thing. only i need to get the URL which i am still unable to get.

here is the exect code which i have used in link.tpl

Content visible to registered users only.

i have commented the my actual code. in above code docalc() , when i pass the last variable hardcoded , say "yahoo.com"
output is perfect as expected, where as $link['URL'] is not working.
so commented the code , i just tried to print that $link['URL'] , and i get nothing.

can you please give me some other idea for this.

just forget about every thing else . what i need is simply

Content visible to registered users only.

i should get some URL. thats all i need , but i need this in link.tlp


thanks again for your Previous reply, that is really appreciable
i will wait for your answer

Ali Kashif

Boby
09-12-2006, 12:06 AM
Isn't that a spellink in the variable? Try the following for the correct array populated by default with links by phpLD: $links['FOO']

Or are you using a custom array $link ??