Just one of my page files has a block named ''sidebar''. --- name:sidebar In the main template I write <webgen:block name="sidebar" /> When rendering, webgen complains that other files don''t have the block sidebar. Should I use an erb conditional in the template, and if yes, how do I write it? Thanks, Michael
Am Wed, 22 Oct 2008 22:40:58 +0200 schrieb Michael Franzl <m.franzl at aon.at>:> Just one of my page files has a block named ''sidebar''. > > --- name:sidebar > > In the main template I write > > <webgen:block name="sidebar" /> > > When rendering, webgen complains that other files don''t have > the block sidebar. Should I use an erb conditional in the > template, and if yes, how do I write it?Hi Michael, yes, I do this with erb conditionals: <% if content_node.node_info[:page].blocks.has_key?(''sidebar'') %> <webgen:block name="sidebar" /> <% end %> However, if you have nested templates, this won''t work. I have to think about a nice solution for this problem. -- Thomas
> However, if you have nested templates, this won''t work. I have to > think about a nice solution for this problem.Yes, have nested templates. I worked around like this in default.template: <% if node[''identifier''] == "particluar-page" %> <webgen:block name="sidebar" chain="default.template" /> <% end %> But it would be much more beautiful if the sidebar content would be declared in the page it belongs to. Michael
Am Thu, 23 Oct 2008 18:00:17 +0200 schrieb Michael Franzl <franzl at corporatematters.at>:> > However, if you have nested templates, this won''t work. I have to > > think about a nice solution for this problem. > > Yes, have nested templates. > > I worked around like this in default.template: > > <% if node[''identifier''] == "particluar-page" %> > <webgen:block name="sidebar" chain="default.template" /> > <% end %> > > But it would be much more beautiful if the sidebar content would be > declared in the page it belongs to.As I have said, I will look at the blocks content processor and see what I can come up with. What I have thought of currently: * new implementation should be backwards compatible * option for failing silently if block is not found * option for searching block through whole node chain, not only in the next node in the chain Any other ideas? Comments? -- Thomas