Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Please Help Someone!

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
ahalliday
Smarty n00b


Joined: 11 Jul 2003
Posts: 3
Location: London

PostPosted: Fri Jul 11, 2003 7:05 pm    Post subject: Please Help Someone! Reply with quote

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 Smile
Back to top
View user's profile Send private message Visit poster's website
AZTEK
Smarty Pro


Joined: 16 Apr 2003
Posts: 235
Location: Purdue University

PostPosted: Fri Jul 11, 2003 7:20 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
ahalliday
Smarty n00b


Joined: 11 Jul 2003
Posts: 3
Location: London

PostPosted: Fri Jul 11, 2003 7:39 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Jul 11, 2003 7:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
ahalliday
Smarty n00b


Joined: 11 Jul 2003
Posts: 3
Location: London

PostPosted: Fri Jul 11, 2003 9:33 pm    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message Visit poster's website
BloodRath
Smarty Rookie


Joined: 06 Jul 2003
Posts: 23
Location: France

PostPosted: Sat Jul 12, 2003 12:31 am    Post subject: Reply with quote

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.... Wink
Back to top
View user's profile Send private message
AZTEK
Smarty Pro


Joined: 16 Apr 2003
Posts: 235
Location: Purdue University

PostPosted: Sat Jul 12, 2003 12:37 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP