![]() |
How can I get this stuff from PHP to Smarty?
I'm still trying to learn this smarty templating, much more of a learning curve then I was expecting...Anyway, how do you think I could get something like the following to show up properly in the page? Lets say I have an array of
$test = array(blue, yellow, red, orange); How can I get this to show up in a select box on my page? The will be dynamic based upon a couple variables received by the page, thats why I don't just type them straight into the template... Thanks in advance for your help, I appreciate all the help I've gotten so far. |
Something like this assuming you're using the get method of a form. This also assumes you've passed $test properly to smarty.
Quote:
Carrie |
Re: How can I get this stuff from PHP to Smarty?
Quote:
I found this snippet on the Zend site (http://www.zend.com/zend/tut/tutorial-cezar.php): You can create an array in PHP an pass it to the template: Code:
$tmp = array ( 'UID'=> '10', &'Name' => 'John Doe', 'Address'=>'Home address'); Then build the drop-down from the array. I haven't tried it, but it looks pretty straightforward. |
Thanks for the advice, I'll be playing with it tonight to see if I can figure something out.
|
I can't believe I put this off for so long, its probably the easiest thing I've done with this site. Thanks guys.
|
Smarty is a very simple program to do some awesome html stuff
check out http://smarty.php.net and check out the documentation it has all the functions and some good examples. |
All times are GMT -8. The time now is 03:39 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.