Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Surround each label of html_checkboxes with a custom tag

 
Post new topic   Reply to topic    Smarty Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
Borgtex
Smarty Rookie


Joined: 28 Mar 2011
Posts: 8

PostPosted: Tue Jul 17, 2012 10:00 am    Post subject: Surround each label of html_checkboxes with a custom tag Reply with quote

As the separator option did'nt gives the flexibility I need to apply css styles, I've added a new option "tag" to the html_radios and html_checkboxes functions to surround each label with whatever tag you want, i.e.:

{html_checkboxes name='id' options=$cust_checkboxes selected=$customer_id tag='li'}

would produce
<li><label><input type="checkbox" name="id[]" value="1000" />Joe Schmoe</label></li>
<li><label><input type="checkbox" name="id[]" value="1001" checked="checked" />Jack Smith</label></li>

I know you can do the same assigning the result of html_checkboxes to an array and then looping through it, but it's less intuitive and with more amount of code, so I was wondering if this could be added to the official release
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 698
Location: Germany, border to Switzerland

PostPosted: Tue Jul 17, 2012 11:31 am    Post subject: Reply with quote

Maybe something along the lines of { wrap="<li>%s</li>"} is more flexible?
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Feature Requests All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP