Forum Moderators: coopster

Message Too Old, No Replies

Smarty Variable on closed brackets?

Smarty Variable on closed brackets?

         

swapshop

11:32 am on Jun 17, 2008 (gmt 0)

10+ Year Member



Trying to use <snip> ajax rating-bar to make it so users get there own rating in stars? We have a classifieds site

Script is php/ajax

Issue is this code isnt working with smarty templates

echo rating_bar($user_id,5); 

this will show the user number {$user_id} how do I now put this into the statement?

Tried

echo rating_bar({$user_id},5); 

this gives me a unexpected '{', expecting ')'

Tried

echo rating_bar('{$user_id}',5); 

that gives me $user_id not the actual variable

Issue seems to be the ability to put the smarty var into () when the smarty var needs {}

So thats

echo rating_bar({$user_id},5); 

Can any one point me in the right direction please

rating_bar is a function below

function rating_bar($user_id,$units='',$static='') {

require('_config-rating.php'); // get the db connection info

//set some variables
$ip = $_SERVER['REMOTE_ADDR'];
if (!$units) {$units = 10;}
if (!$static) {$static = FALSE;}

[edited by: eelixduppy at 12:07 pm (utc) on June 17, 2008]
[edit reason] removed URL, fixed formatting [/edit]

coopster

12:56 pm on Jun 20, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Can any one point me in the right direction please

The smarty documentation pages [smarty.net] are one of your primary resources if you are incorporating this templating engine.