Stack of stacks - possible?

Permalink
Would it be possible to make a stack of stacks?

I created a mega menu block that creates a menu based on a stack of blocks. Each block becomes an item on the mega menu.

It would be super cool if I could have a stack of stacks, that way I could have multiple blocks in each drop down, and do things like have an email form and regular content on the same drop down menu.

I suppose I could made a series of stacks and name them in a specific way ( menu_1, menu_2, menu_3, etc. ) and then build the single menu off that, but it is not so elegant...

Any thoughts?

adavis
View Replies:
mkly replied on at Permalink Reply
mkly
Well stacks are just pages so you could base it off an attribute.

Create a checkbox attribute called 'in_mega_menu' and filter off that with.

$sl = new StackList();
$sl->filterByAttribute('in_mega_menu', 1);
$stacks = $sl->get();
foreach($stacks as $stack) {
  $stack->display($c);
}


or something.
PauloCarvalhoDesign replied on at Permalink Reply
PauloCarvalhoDesign
Hi mkly, I have attempted that however found no way to load header and footer items from each block, like css and js.
Have you gat any idea how to do that?
JohntheFish replied on at Permalink Reply
JohntheFish
If js is not sensitive to position in a page, you can put <script> tags anywhere in your html.

Browsers will generally let you get away with the same for css, but it is not valid and I seem to remember reports of it being erratic in older version of IE.

You can also use a lazy loader in JavaScript. These usually work by writing a script or style tag into the dom of the header after the page has loaded. Concrete has one called (if I remember correctly) something like ccm_addHeaderItem() that you can use from script.
PauloCarvalhoDesign replied on at Permalink Reply
PauloCarvalhoDesign
I have replied wrongly here, however John, would be very interested in your opinion on this.
What I have done and I have it working his:
Loop through all blocks in a stack and output them one by one, doing this I cant send the css and js for each of them.
JohntheFish replied on at Permalink Reply
JohntheFish
Do you mean the css and js automatically associated with a block and added when a block is viewed?

If you have the block handles for the blocks in the stack, then you should be able to mimic what C5 would do by either listing files in the block or testing for specific files and building a list. The difficult part would be where alternate templates have js or css, but again that is something you could unravel from core code.

Given a list of css and js files, you can then (ideally) output that in the on_page_view() of your block controller. or if you are too far on for that, create script in your block view which does the lazy loading.

I have not looked at how glockops does this with the blocks in prb. There seems to be enough reviewers already looking at these.
glockops replied on at Permalink Reply
glockops
You can make a "stack displayer" block and add that to a stack. As long as it doesn't reference itself you shouldn't have a problem.

I actually have two marketplace items in the PRB that are awaiting approval. One is a stack selector attribute / form helper and the other is a stack randomizer block.

Once/if the stack selector attribute gets approved you can use the "stack selector" form helper to easily select a stack in a custom block you build..

Look for them soon (they will be free). Shoot I'll go ahead and make a "stack displayer" block too - never saw the need for it.. but it apparently exists.
glockops replied on at Permalink Reply 1 Attachment
glockops
Hey adavis,
I created the "stack displayer" block. It's currently awaiting marketplace approval - but here's the beta version - take a look and let me know if it meets your needs.

Note: it prevents a user from having a stack display itself - I might add a front-end check for this as well, but in any case - it should work for your needs.
adavis replied on at Permalink Reply
adavis
Cool I'll check it out when I get time, Thanks
-Andrew
malkau replied on at Permalink Reply
malkau
could you make one for 5.7? :) it'd be so handy for me right now...
glockops replied on at Permalink Reply
glockops
Sorry! But I'll have to say I won't be creating a 5.7 addon. However, the
code is on github if someone else wants to fork and make a 5.7 compliant
one.

I've moved on to another job with a different CMS and haven't touch
concrete5 in months.
On Fri, Feb 27, 2015 at 12:39 AM concrete5 Community <
[email protected]> wrote: