Table of contents
Permalink
Is there a standard way to build a table of contents of the blocks shown within an area?
No, there is no standard way to do this. It's not too difficult to get a list of all the blocks in an area with code like this:
The real problem is: what do you want the table of contents to show exactly? Blocks don't have names, so how would you decide what exactly to list in the table of contents?
<?php $blocks = Page::getCurrentPage()->getBlocks('Main'); //<--replace 'Main' with the name of the area you want foreach ($blocks as $b) { //do something... but what? } ?>
The real problem is: what do you want the table of contents to show exactly? Blocks don't have names, so how would you decide what exactly to list in the table of contents?
You are right. But thanks, I can think of something from here..
maybe take a look at:
http://www.concrete5.org/marketplace/addons/example-faq/...