Would it be possible to dynamically choose a given masterpage at runtime, based on published properties?
I would like to realize a kind of template inheritance on folder, as in the following (simplified) example.
Say I have a basic document type with just title and bodytext and a simple site design with the usual header and a left navigation menu.
This basic doc type can be shown alone (i.e. with a template that simply adds header and left menu) or within a Dossier or a Subsection (or even in a Dossier within a subsection...).
A Dossier adds a right navigation menu, and a Subsection adds an extra horizontal navigation menu, leading to four different templates:
Simple page
+----------------------------+
| head |
+------+---------------------+
| | Title |
| | |
| left | BodyText |
| menu | |
| | |
| | |
| | |
| | |
+------+---------------------+
Dossier page
+----------------------------+
| head |
+------+-------------+-------+
| | Title | |
| | | |
| left | BodyText | right |
| menu | | menu |
| | | |
| | | |
| | | |
| | | |
+------+-------------+-------+
Subsection page
+----------------------------+
| head |
+------+---------------------+
| | horizontal menu |
| +---------------------+
| left | Title |
| menu | |
| | BodyText |
| | |
| | |
| | |
+------+---------------------+
Dossier page in a subsection
+----------------------------+
| head |
+------+---------------------+
| | horizontal menu |
| +-------------+-------+
| left | Title | right |
| menu | | menu |
| | BodyText | |
| | | |
| | | |
| | | |
+------+-------------+-------+
The real example is a bit fancier so I can't just put horizontal and right menu in macros that return nothing in the wrong templates, so I end up having 4 templates which share the same content for the main content (Title and BodyText), which is a bit frustrating.
I would like to be able to define the main content in a simple template that chooses at runtime which parent master page to use.
I am not sure or this is possible, but i had once something similar where i handled everything in a "wrapper" macro which did check the elements of a page and based on that rendered the page.
I guess I'd be able to hack something, in the end, but I would prefer a more elegant approach, something emulating the ability of ASP.NET to declare in web.config specific master pages for a given folder...
Dynamically choose a given masterpage at runtime
Would it be possible to dynamically choose a given masterpage at runtime, based on published properties?
I would like to realize a kind of template inheritance on folder, as in the following (simplified) example.
Say I have a basic document type with just title and bodytext and a simple site design with the usual header and a left navigation menu.
This basic doc type can be shown alone (i.e. with a template that simply adds header and left menu) or within a Dossier or a Subsection (or even in a Dossier within a subsection...).
A Dossier adds a right navigation menu, and a Subsection adds an extra horizontal navigation menu, leading to four different templates:
The real example is a bit fancier so I can't just put horizontal and right menu in macros that return nothing in the wrong templates, so I end up having 4 templates which share the same content for the main content (Title and BodyText), which is a bit frustrating.
I would like to be able to define the main content in a simple template that chooses at runtime which parent master page to use.
Is there a way to achieve this?
I am not sure or this is possible, but i had once something similar where i handled everything in a "wrapper" macro which did check the elements of a page and based on that rendered the page.
I guess I'd be able to hack something, in the end, but I would prefer a more elegant approach, something emulating the ability of ASP.NET to declare in web.config specific master pages for a given folder...
Maybe I'm asking too much :)
is working on a reply...