Ability to apply multiple custom templates to a block

Permalink
Hi,

i wonder if anyone has thought how to apply multiple custom templates to a block. For instance, the first template that you apply would take care of displaying the items. Then the next one will "inject" code for facebook like buttons, and the last one takes care of the layout.

While i am writing this i realise that this will be pretty hard to realize, but also be very powerfull.

Anyone any thoughts?

Wik

meshen
 
jordanlev replied on at Permalink Reply
jordanlev
What you're describing already exists, but I think you're misunderstanding how the architecture works. The controller handles which items are displayed, and the custom template handles the layout. The facebook like button should probably be a separate block (or hard coded into your theme templates if they appear on every page of a certain type).
meshen replied on at Permalink Reply
meshen
Jordan,

i think i really well understand how the block templates work.

Let me give a better example:
Suppose you take the page list block, and create your own template to handle the paging a bit different. Lets say you customise it is such a way that you can use jquery.inifinitescroll. In this way you can hide the paging and as users scroll down your page new content is loaded in the background. By itself this template can now be used as a base, that you can extend to use in multiple projects.

So, if you want to extend this template, it would be really nice if you can apply new templates to this new paging template. With other words, if you want to make new content fly in, that will be handled in the NewContentFlyin template.

Does this make sense?

Wik
jordanlev replied on at Permalink Reply
jordanlev
Okay, I understand the use case you describe. I think in concrete5 this would best be handled by a helper or a library that you the developer would integrate into different custom templates for different blocks.

This is just my opinion, not fact, but I think the system you describe adds more complexity than is necessary. I don't see it being something that could work smoothly -- combining different front-end widgets and functionalities onto different block front-ends (each with different purposes, different html/css output, and often their own javascript things going on) would wind up requiring custom coding to make each combination work anyway. To me, I don't see how there is really much efficiency gained over just figuring out how to make the paging effect (for example) work and then apply it to several different custom templates for several different blocks.

Try thinking through the details to see what I mean about the complexity -- let's say you have this javascript pagination thing... how does that apply to any block other than Page List? I suppose it might work on the Search Results block, but that block is weird because it combines both the search form and the search results in one. How would the pagination work on the content block? On an image block? etc.?

Just my 2 cents -- I don't think it's a bad idea, just don't see how it could be implemented practically without adding more complexity than it solves.

-Jordan