Created
August 20, 2013 19:58
-
-
Save jbroadway/6286438 to your computer and use it in GitHub Desktop.
Dynamically populated select box in an Elefant CMS template.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- apps/test/views/select.html --> | |
<select name="type"> | |
{% foreach options as val, label %} | |
<option value="{{val}}"{% if selected == $data->val %} selected{% end %}>{{label}}</option> | |
{% end %} | |
</select> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // apps/test/handlers/select.php | |
echo $tpl->render ( | |
'test/select', | |
array ( | |
'options' => array ( | |
'foo' => 'Foo', | |
'bar' => 'Bar', | |
'baz' => 'Baz' | |
), | |
'selected' => 'bar' | |
) | |
); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment