Dynamically created page based on elsewhere blocks

Permalink
Hi all...just want to check my thought process on something:

I want to have some private pages that individuals edit. Each of those private pages have content blocks in them, with Block names that I have set as a custom design (let's call them customName1, customName2, etc.).

I want to create one page in the site that dynamically assembles itself based on the current contents of all/some of those other blocks.

Would it be as simple as creating a page and using the "Simple PHP Block" to say:

$block = Block::getByName('customName1');
$block->display();


...to display the individual blocks, calling them by name?

Extending that analogy, I could create static graphic elements inside of blocks in a stack and call those to make the rendered page even nicer looking.

Is this feasible? I ask now because the simple PHP block is not approved for 5.5.x and I cannot test it directly right now.

Thanks!

Nick

pendragn
 
jordanlev replied on at Permalink Best Answer Reply
jordanlev
This approach doesn't sound ideal to me -- seems like it has too many "moving pieces" and would break easily. I could be misunderstanding your use case, but I'd try making a custom template for the page list block (or a custom block or single_page that uses the PageList API to query pages) and pull blocks that way. See the "Page List Teasers" addon in the marketplace for examples of how to pull out blocks from a page, or see the code comments in this custom page list template:https://github.com/jordanlev/c5_clean_block_templates/blob/master/pa... (see the "HOW TO DISPLAY ACTUAL PAGE CONTENT:" section).
pendragn replied on at Permalink Reply
pendragn
Hi Jordan...wow, thanks..a lot to read.

I basically desire to create a "dashboard" type functionality. Where people edit their pages, and the "important dashboard" pieces get pulled out from those pages and put into another page.

Kind of like in a spreadsheet, where a sub-sheet has an item that gets marked as "red", and the main overview page has linked to that specific field and automatically becomes red as well. Here, I would be talking about any sort of block, but the analogy is the same.

I am looking over the code in the Page List Teasers as well as the code link you provided, and I am thinking that this statement is true:

-Individual components on a page are not individually assigned/identified so that they can be directly referenced later.

...This is probably because of Concrete5 being a MVC, the page gets dynamically created anyway and there is no concept of a statically-assigned block.

If I labelled each content block I want to put into the "Dashboard" with an absolutely unique "Custom Template --> Block name" could I call those into a Dashboard-like page?

I know this would not be entirely scalable, but I only really need to set this up once for the team I am considering this for.

Nick
jordanlev replied on at Permalink Reply
jordanlev
You might want to check out the Composer feature in the dashboard -- it might provide the infrastructure you need. (I'm not sure about that though because honestly I don't understand entirely what it is you're trying to achieve -- but it sounds vaguely familiar to what Composer does).

As for your question about pulling blocks with unique block names -- yes I believe that should work.