Adding a select option to a div class
Permalink Browser Info Environment
Hi
I've set up a block and wanted to have the ability to change the styles of the block dependant on the selection we choose - so I've set up a block with a few select options of red, green and blue
If I then choose the blue option the class is applied to the div wrapper and the styles can kick in and change the box to red or blue ect.
I've tried this but I don't know the php code to place the option into the div. Tried this but not loaded in.
<div class="serviceBox" id="<?php echo $field_5_select_value-> value ?>">
Is this possible or can you guide me in the right direction?
Cheers, Matt
I've set up a block and wanted to have the ability to change the styles of the block dependant on the selection we choose - so I've set up a block with a few select options of red, green and blue
If I then choose the blue option the class is applied to the div wrapper and the styles can kick in and change the box to red or blue ect.
I've tried this but I don't know the php code to place the option into the div. Tried this but not loaded in.
<div class="serviceBox" id="<?php echo $field_5_select_value-> value ?>">
Is this possible or can you guide me in the right direction?
Cheers, Matt
Type: | Discussion |
---|---|
Status: | New |
Cool thanks for this Jordan
WE did figure a workaround by adding
<div class="serviceBoxFULL Serv<?php echo $field_5_select_value;?>">
and then setting a Serv2,Serv3,Serv4 classes in the stylesheet
Demo here -
http://bigcopystudio.co.uk.gridhosted.co.uk/...
Will put your way on a custom template withing the same set :)
Matt
WE did figure a workaround by adding
<div class="serviceBoxFULL Serv<?php echo $field_5_select_value;?>">
and then setting a Serv2,Serv3,Serv4 classes in the stylesheet
Demo here -
http://bigcopystudio.co.uk.gridhosted.co.uk/...
Will put your way on a custom template withing the same set :)
Matt
Then in the block view.php file, you can output the class that corresponds to the selection of the dropdown. For example (in your view.php file):
When the block was first created, it should have put the "if" statements into the view.php code (if you've since deleted it, you could temporarily create another block with the same options, copy the code from that new block's view.php file, paste it into your existing one, then uninstall/delete the other block).
Hope that helps!
-Jordan