View previous topic :: View next topic |
Author |
Message |
ahalliday Smarty n00b
Joined: 11 Jul 2003 Posts: 3 Location: London
|
Posted: Fri Jul 11, 2003 7:05 pm Post subject: Please Help Someone! |
|
|
I am using XCart which is made in Smarty and i am doing some custom design work for my client. On one of the pages there is a variable in the HTTP string that i need to work with.
When is put $productid into my php block it does not seem to find it. I can't use the {product.productid} code either because that gives me an output of Product.Array. I am extremely confused and would appreciate any help. I need to put that variable into a mysql query.
Thanks so much in advance.
Alex |
|
Back to top |
|
AZTEK Smarty Pro
Joined: 16 Apr 2003 Posts: 235 Location: Purdue University
|
Posted: Fri Jul 11, 2003 7:20 pm Post subject: |
|
|
Perhaps you mean {$smarty.get.productid} if its sent via a get request _________________ "Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane |
|
Back to top |
|
ahalliday Smarty n00b
Joined: 11 Jul 2003 Posts: 3 Location: London
|
Posted: Fri Jul 11, 2003 7:39 pm Post subject: |
|
|
AZTEK wrote: | Perhaps you mean {$smarty.get.productid} if its sent via a get request |
Thanks for your help! how would i call that from php? because if you call $smarty.get.productid in a php block it will simply print productid because that will add it to the existing string.
I would apprecaite your help so much in this matter.
Alex |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Fri Jul 11, 2003 7:55 pm Post subject: |
|
|
Do you mean from a {php} ... {/php} block? If so, I'm not sure, but I don't think it is available there.
BUT, ye good old PHP superglobals area vailabe within {php} blocks, so you can use $_REQUEST['productid'] for example. |
|
Back to top |
|
ahalliday Smarty n00b
Joined: 11 Jul 2003 Posts: 3 Location: London
|
Posted: Fri Jul 11, 2003 9:33 pm Post subject: |
|
|
I managed to fix it by redifining it from $product.id to $productid and it works, i think the . in there confuses php.
Thanks though!
Alex |
|
Back to top |
|
BloodRath Smarty Rookie
Joined: 06 Jul 2003 Posts: 23 Location: France
|
Posted: Sat Jul 12, 2003 12:31 am Post subject: |
|
|
i'm not sure this is the same problem
but i sometime need to affect to a formfield a default value gained trough a typical mysql query (we said here i'll affect it to $row)
i could'nt use assign("var",$row); and use $row.id_user (by example) cause $row is evalued before the right part [smarty send to me Array.id_user], so i use this method :
calling it in template by $.row.id_user , i rewrite the funcion formfield, to regexp the params and reconstruct a good reference to my assigned var in the _tpl_var.
it seems to work perfectly
espair it could help u _________________ froggies forever.... |
|
Back to top |
|
AZTEK Smarty Pro
Joined: 16 Apr 2003 Posts: 235 Location: Purdue University
|
Posted: Sat Jul 12, 2003 12:37 am Post subject: |
|
|
Just use Code: | {somefunc param="ID: `$row.id_user`"} |
_________________ "Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane |
|
Back to top |
|
|