I'm creating a fundraising site that displays the progress toward a goal as a percentage. I fetch the total donations from a MYSQL table and divide by the project's goal to calculate a percentage. I use an editable region in the clonable template to set the goal.
This works properly, but when I try to use the variable $progress later on in the template, it's empty.
How can I make a variable created in one <cms:php> tag persist into another?
Thanks,
Tim
- Code: Select all
<cms:php>
$progress = round(($total/<cms:show project_goal />)*100);
//variable $total is fetched from a database earlier in the code
</cms:php>
This works properly, but when I try to use the variable $progress later on in the template, it's empty.
- Code: Select all
<p><cms:php>echo $progress;</cms:php>% of $<cms:show project_goal /> Raised</p>
How can I make a variable created in one <cms:php> tag persist into another?
Thanks,
Tim