Page 1 of 1
Passing/getting a variable
Posted: Wed Jan 27, 2010 2:30 pm
by bali2002
Hi guys hope you can help me.
this string:
<a href="{$article.link}?tid=<? echo $_GET['kw']; ?>">
produces this output:
http://articlelink.php/?tid=<? echo $_GET['kw']; ?>
for some reason the variable 'kw' is not transfered from the link:
http://link.php?kw=whatever
Any help?
Re: Passing/getting a variable
Posted: Wed Jan 27, 2010 2:40 pm
by AbraCadaver
Most likely your file is .htm or .html? Try changing to .php. Most webservers don't parse .htm, .html files with PHP by default.
Re: Passing/getting a variable
Posted: Wed Jan 27, 2010 2:51 pm
by bali2002
No sorry I've already changed to .php
Re: Passing/getting a variable
Posted: Wed Jan 27, 2010 2:52 pm
by AbraCadaver
bali2002 wrote:No sorry I've already changed to .php
Actually, on second look, it looks like a template file. The template engine probably doesn't parse PHP in the template.
Re: Passing/getting a variable
Posted: Wed Jan 27, 2010 2:57 pm
by bali2002
Yes! I hadn't noticed that!
It is a .tpl
Any solution?
Thanks
Re: Passing/getting a variable
Posted: Wed Jan 27, 2010 3:15 pm
by AbraCadaver
bali2002 wrote:Yes! I hadn't noticed that!
It is a .tpl
Any solution?
Thanks
This is not PHP, this is a secondary system (template engine, framework, something else). Wherever you set template vars you would set a var kw = $_GET['kw'] and then use {$kw}, or you could try:
Code: Select all
<a href="{$article.link}?tid={$_GET.kw}">
That is just a wild guess as I have no idea what this system is or is doing.