How to pass a variable to a function in Xataface

A place for users and developers of the Xataface to discuss and receive support.

How to pass a variable to a function in Xataface

Postby 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
angie
 
Posts: 12
Joined: Fri Mar 13, 2009 9:45 am

Postby 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')}
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Thanks, Steve.

Postby angie » Fri Mar 13, 2009 11:14 am

According to your suggestions, I have fixed the problem. Thank you very much.

Angie
angie
 
Posts: 12
Joined: Fri Mar 13, 2009 9:45 am


Return to Xataface Users

Who is online

Users browsing this forum: Google [Bot] and 14 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved