Nested area. It works! Could this be a solution?
Permalink 1 user found helpful
Hi there. This is my 1st thread here, so don't judge too much.
Please examine the following, and tell me is everything is OK.
Note: everything seems to work fine, but I am not sure that such things "are allowed".
Briefly, I needed to split content into several columns.
Creating them through "Add layout" was OK, but this added a number of nested <div> wrappers, that in my particular case was bad.
After few attempts of constructing blocks with Designer Content Package the idea was to hardcode a new blocktype that would render columns-areas in which any other blocktype can be inserted: i.e. block-in-area-in-block.
So, finally this is what it looks like (here I provide just a concept).
Creating a new blocktype with the following view.php (controller.php, db.xml etc. are default-simple here)
After inserting this block to the page, I can easily put any other blocktype into it and successfully publish the edits (on different pages as well).
This was just a concept. By adding some areas to view.php and few attributes to the controller, such parameters as quantity, size etc. can be managed and rendered.
I've searched through related topics concerning nested blocks and areas, but found almost nothing about it.
I am not known well in the deepest details of concrete5 structure, so I am asking experts:
Really, can this be used?
And what are the weak spots and disadvantages of this method?
Can it make some conflicts in C5 work?
Please examine the following, and tell me is everything is OK.
Note: everything seems to work fine, but I am not sure that such things "are allowed".
Briefly, I needed to split content into several columns.
Creating them through "Add layout" was OK, but this added a number of nested <div> wrappers, that in my particular case was bad.
After few attempts of constructing blocks with Designer Content Package the idea was to hardcode a new blocktype that would render columns-areas in which any other blocktype can be inserted: i.e. block-in-area-in-block.
So, finally this is what it looks like (here I provide just a concept).
Creating a new blocktype with the following view.php (controller.php, db.xml etc. are default-simple here)
<?php defined('C5_EXECUTE') or die(_("Access Denied.")) ?> <?php $page = Page::getCurrentPage(); $a = Area::getOrCreate($page, 'Test Area'); $a->display($page); // some variables to use later; $areaID = $a->getAreaID(); $blockID = $b->getBlockID(); $blockAreaID = $b->getBlockAreaObject()->getAreaID(); // need to catch the nasty #ccm-highlighter <div> that overlays the block // and also the newly created area, thus making impossible to edit it if ($page->isEditMode()) echo <<<EOT <script> (function(){
Viewing 15 lines of 53 lines. View entire code block.
After inserting this block to the page, I can easily put any other blocktype into it and successfully publish the edits (on different pages as well).
This was just a concept. By adding some areas to view.php and few attributes to the controller, such parameters as quantity, size etc. can be managed and rendered.
I've searched through related topics concerning nested blocks and areas, but found almost nothing about it.
I am not known well in the deepest details of concrete5 structure, so I am asking experts:
Really, can this be used?
And what are the weak spots and disadvantages of this method?
Can it make some conflicts in C5 work?
I haven't tried the code yet - however at a glance it looks like the only problem might be that once you add the parent block to a page you cannot move or remove it as the sub areas take focus?