CodeIgniter Forums
How to style timezone_menu() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: How to style timezone_menu() (/showthread.php?tid=971)



How to style timezone_menu() - behnampmdg3 - 02-02-2015

Hi;

How can I add a class to the drop down created by timezone_menu()?

This doesn't seem right:

$this->data['timezones'] = timezone_menu('','form-control');

Thanks


RE: How to style timezone_menu() - InsiteFX - 02-02-2015

Control styles are done using CSS styles.


RE: How to style timezone_menu() - behnampmdg3 - 02-02-2015

(02-02-2015, 05:53 AM)InsiteFX Wrote: Control styles are done using CSS styles.
How can I add id?


RE: How to style timezone_menu() - advoor - 02-02-2015

The code does look correct (the timezone function usage). Is there any output displayed?


RE: How to style timezone_menu() - CroNiX - 02-02-2015

Hard to know without seeing your timezone_menu() code. Like is it outputting HTML, using the form_dropdown() helper, or what?

But using CI's native form_dropdown(), it would be (just like the docs state) entering the custom id/class/other attributes in the 4th parameter.
Code:
echo form_dropdown('name_of_dropdown', $dropdown_value_array, $selected_value, 'id="my-id" class="some-class"');



RE: How to style timezone_menu() - mwhitney - 02-02-2015

timezone_menu('','form-control'); should generate something like:
Code:
<select name="timezones" class="form-control">
   <option value="UM12">(UTC -12:00) Baker/Howland Island</option>
   <!-- ... etc. -->
</select>

So you should be able to apply your desired styles to the form-control class.