Jahia Template Forum > How do I do sub-templates?

0 (0 Good)
0 (0 Bad)

How do I do sub-templates?

by  gs »  2014/04/28 02:29

I have a typical use case: I need to implement level1 and level 2 page templates, with common header, footer and navigation, but with different layouts and contents for main content sections.

The primary difference from the video tutorials is that I cannot use the visual designer to do layout as the HTML markups are done by a third-party web designer and I cannot change the structure of the HTML codes. The CSS is customised and does not use any CSS frameworks.

One solution I can think of is to implement the header, footer, navigation, level 1 content, level 2 content, etc as individual modules that I can "drop" into the page using the Studio design tool, thereby preserving the original markup. But it seems overkill to implement entire modules when I just want sub-templates, or is this in fact the correct way? Also, I'm not sure if there are any caching-related issues this way.

Another way I found is to implement them as alternative views of the same main template. I used a <template:include> to bring in another view (e.g. "subview", which includes some static text and a <template:area>. I found that this works when I did not specify a view - I can activate the area and add content to it. However, when I specified "subview" as the view for the page template, the area doesn't even appear. Is this a bug or is this the intended behaviour?

 

  • How do I do sub-templates?
    2014/04/28 02:29

    gs <p> I have a typical use case: I need to implement level1 and level 2 page templates, with common header, footer and navigation, but with different layouts and contents for main content sections.</p> <p> The primary difference from the video tutorials is that I cannot use the visual designer to do layout as the HTML markups are done by a third-party web designer and I cannot change the structure of the HTML codes. The CSS is customised and does not use any CSS frameworks.</p> <p> One solution I can think of is to implement the header, footer, navigation, level 1 content, level 2 content, etc as individual modules that I can &quot;drop&quot; into the page using the Studio design tool, thereby preserving the original markup. But it seems overkill to implement entire modules when I just want sub-templates, or is this in fact the correct way? Also, I&#39;m not sure if there are any caching-related issues this way.</p> <p> Another way I found is to implement them as alternative views of the same main template. I used a &lt;template:include&gt; to bring in another view (e.g. &quot;subview&quot;, which includes some static text and a &lt;template:area&gt;. I found that this works when I did not specify a view - I can activate the area and add content to it. However, when I specified &quot;subview&quot; as the view for the page template, the area doesn&#39;t even appear. Is this a bug or is this the intended behaviour?</p> <p> &nbsp;</p>

  • Number of messages  2
    Registration date Apr 28, 2014
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page