[TYPO3] Sub-Templates?

Christopher bedlamhotel at gmail.com
Thu Jul 20 20:48:56 CEST 2006


Hi Amir,

On 7/21/06, Amir M. <amir219 at sbcglobal.net> wrote:
> Hi,
>
> I am not sure if this question has been addressed before, since I cannot
> search the archives, but I am interested in creating sub-templates for
> sections of my site.
>
> For example, here is my main page:  www.stratcommandcenter.com/redesign4
> As you can see the banner says "Strategic Command Center"
>
> However, for the sub-sites of the main site I'd like to create a
> different banner, so there is a recognizable difference between the
> sub-sites.  Here are the links to the subsites:
>
> http://www.stratcommandcenter.com/redesign4/civilization-iv/
> http://www.stratcommandcenter.com/redesign4/total-war-series/
>
> What would be the best way to use a different banner for each subsite?
>
> Note, all the pages and all the sites use the same template, and I like
> it that way, since I do want a unified design, however all I want is to
> make a different banner for each section/sub-site.

You have about 10000 different possibilities. The simplest is probably
to define the layout used by the _majority_ of the pages and then
override that layout for the minority page(s) using a TS condition
[1]. For example, if your header is defined as a TS object something
like this:

# Header object for all inside pages:
page.10 = HTML
page.10 {
  value (
<!-- [header content goes here] -->
)
  value.wrap = <div id="header">|</div>
}

...you can override it with a TS condition:

[treeLevel = 0]
page.10.value (
<!-- [some different content goes here] -->
)
[global]

If you'd rather keep the content the same, and just change how it
_looks_ on one page compared to another, you could use a similar
strategy to change the body element on the page:

# Default body tag:
page.bodyTagCObject = HTML
page.bodyTagCObject {
  value = <body>
}

# Body tag for root page of site only:
[treeLevel = 0]
page.bodyTagCObject.value = <body id="root">
[global]

In this case, you'd make the changes in appearance in the stylesheet:

/* Default appearance */
#header {
 /* styles */
}

/* Root page appearance */
body#root #header {
 /* styles */
}

Thirdly, you could also use a completely separate TS template and
select it in the "Template on next level:" field in your main TS
template.

-Christopher

[1] http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/7/5/



More information about the TYPO3-english mailing list