[TYPO3-dev] Dynamically load TS/CSS/JS/HTML based on the new backend layout

Thomas "Thasmo" Deinhamer thasmo at gmail.com
Fri Mar 18 17:16:02 CET 2011


Hello all!

Based on the new backend layout setting I'd like
to load all related assets which I need to display
a layout in the frontend, dynamically.

This means I want to include a separate HTML template
(marker content), separate CSS and JS files and also
custom TypoScript for each layout.

Prior to this I used a dedicated static template for
each layout and included it manually on each page.
(Therefor clients couldn't change the layouts.)

This way quite easy, because I just could use the
constants to get my desired files:

page.includeCSS {
	layoutFile = css/{$application.template.layout}.layout.css
}

So I didn't need any conditions and could just use
a single line to include any configured layout.

As for now, the layout is set dynamically, based on
the backend layout field, and unfortuately I can't
use this technique anymore.

What would be the best solution to load all needed assets
with as few TS code as possible, without any hooks or custom code?

What I also like to do, is to include typoscript files
dynamically based on the layout settings; something like this:

<INCLUDE_TYPOSCRIPT: source="FILE: ts/{page|layout}.ts">

Probably this is not possible because inside the source
argument, the layout setting won't be substituted.

Is there also a nice solution for this?

Thanks a lot in advance,
Thomas




More information about the TYPO3-dev mailing list