[TYPO3-mvc] How to add JS and CSS files to a backend module / best way
Stefan Kruse
besucher80 at gmx.de
Mon Apr 8 09:09:13 CEST 2013
Hi , i need to add some js and css files to my backend module. Like jquery
and the twitter bootstrap js file and the css file. I wrote me a viewhelper
like this:
public function render($path, $compress = FALSE) {
$doc = t3lib_div::makeInstance('template');
$pageRenderer = $doc->getPageRenderer();
// JS
if (strtolower(substr($path, -3)) === '.js')
{
$pageRenderer->addJsFile($path, NULL, $compress);
// CSS
} elseif (strtolower(substr($path, -4)) ===
'.css') {
$pageRenderer->addCssFile($path, 'stylesheet', 'all', '', $compress);
}
}
For css files this works, but for js files this doesn't work. There are no
js files included.
I know that the f:be.container ViewHelper has a addJsFile and a addCSsFile
Attribut. But this is only for single files. Or?
Could somebody tell me how is the best way to include multiple js / css
files to a backend module?
Thanks
More information about the TYPO3-project-typo3v4mvc
mailing list