Page 1 of 1

How to pass a variable to a function in Xataface

PostPosted: Fri Mar 13, 2009 10:00 am
by angie
Hi Steve,

I have a file called course.html under templates/chemistry/courses/course/ folder, I tried to pass a variable to a function and failed. The detailed information is as follows:

$courseid={$course->htmlValue('course_id)}, it will return the correct $courseid.

{foreach from=$site->getCoursePersonnel($courseid) key=position_title item=persons name=course_personnel}

The passed in variable $courseid is empty. Could you please advise why and how should I pass this variable to the above function?

Thanks a lot.

Angie

PostPosted: Fri Mar 13, 2009 11:02 am
by shannah
In smarty templates you can't just use '=' to assign values to a variable. You need to use the assign tag.

e.g.
Code: Select all
{assign var="courseid" value=$course->htmlValue('course_id')}

Thanks, Steve.

PostPosted: Fri Mar 13, 2009 11:14 am
by angie
According to your suggestions, I have fixed the problem. Thank you very much.

Angie