Blocks that contain areas?
Permalink
I've spent hours scouring the internet/forums and have not been able to figure out specifically what I'm trying to do.
I've got a page that needs to have a number of sections like so:
The sections must be labeled like this, and have the inner div, for a jQuery page scroll effect. The number of sections is not set-- meaning they need to be able to be added or removed as needed. I can make a "Section" block to do that...
But then, I cannot find out how or if its possible to then be able to drag blocks into this Section. I've had success with adding an Area with a unique name, like so:
But then once blocks are added to it, they become uneditable. So I'm thinking you're not really supposed to do that.
I know I could just build blocks for each type of section the site features, but I'm just wondering if there is a more elegant approach which would allow for more customization.
Any thoughts? Thanks.
I've got a page that needs to have a number of sections like so:
<section class="scroll-section"> <div> <!-- Content Goes Here --> </div> </section>
The sections must be labeled like this, and have the inner div, for a jQuery page scroll effect. The number of sections is not set-- meaning they need to be able to be added or removed as needed. I can make a "Section" block to do that...
But then, I cannot find out how or if its possible to then be able to drag blocks into this Section. I've had success with adding an Area with a unique name, like so:
<section class="scroll-section"> <div> <?php $sectionName = "Section Content (" . $bID . ")"; $sa = new Area($sectionName); $sa->display($c); ?> </div> </section>
But then once blocks are added to it, they become uneditable. So I'm thinking you're not really supposed to do that.
I know I could just build blocks for each type of section the site features, but I'm just wondering if there is a more elegant approach which would allow for more customization.
Any thoughts? Thanks.
The way that we have solved this is to put a number attribute into the system. So you would create an attribute called Page Sections and then in your site your template file you would do something like this
Viewing 15 lines of 17 lines. View entire code block.
This is great. Now, of course, I've run into problems creating an attribute. I can't seem to find a tutorial of how to do that (other than this one from a long, long time ago:http://legacy-documentation.concrete5.org/tutorials/create-a-custom... Any guidance on how to create that, or links that might help? It's obviously super simple-- just need an id and a value-- but this is my first Concrete5 site so I'm very much still learning...
You don't need to create an attribute type, just an attribute. So login to your site, go to the Dashboard -> Pages & Themes -> Attributes -> Scroll to the bottom and select Number from the Add Attribute dropdown and then click Add and it will ask you for a handle (that goes in the getAttribute call in your template) and a Name (that is what will show to the user).
I've been busy coding away, but just wanted to say this solution was exactly what I needed. Thank you!
You can define layouts in a theme and add a layout to a global area. Within a layout, you can drop blocks or another layout. You can do whatever you want with these layouts. The layouts can have multiple columns as well, to generate a predefined "grid" for example (col-sm-3 and col-sm-9 maybe or whatever you please).