Add a class to all blocks added to an Editable area?

Hi People

I wonder if this is possible and easy? I have this but it doesn't do what I want?

<div class="Adverts">
 <?php $a = new Area('Advert Block');$a->display($c) class; ?>

Now what I would like is for each block added to the area "Advert Block" to be assigned the class "Adverts" other than the hole area altogether? So I can assign a float left and margin to each block added with the section?

I know I can do this by adding the class manually in the design of the block, I just wondered if it was possible like this?

 <?php $a = new Area('Advert Block');<div class="Adverts">$a->display($c)</div> 


View Replies: View Best Answer
synlag replied on at Permalink Reply

it might be possible with some javascript magic to add the class to each block in that area, but as you don't know what the output of the views for the specific blocks is, that might be tricky.
Lets assume each block added is wrapped within a div and has "block" within its ID, you could easily grab them via css from your parent div, that has the class "Adverts"

.adverts > div[id*="block"] {
  // do float to the moon

or via jQuery

$('.adverts > [id*="block"]').addClass("holymoly");

Hope it helps

mhawke replied on at Permalink Best Answer Reply
Simply put this code instead:

<div class="Adverts">
   $a = new Area('Advert Block');
   $a->setBlockWrapperStart('<div class="Adverts">');

That will wrap each separate block you add to that area with a div with class="Adverts".