How to pass a variable to a function in Xataface
Archived from the Xataface Users forum.
angie — Fri Mar 13, 2009 10:00 am
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
shannah — Fri Mar 13, 2009 11:02 am
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')}
angie — Fri Mar 13, 2009 11:14 am
According to your suggestions, I have fixed the problem. Thank you very much.
Angie