[TYPO3-mvc] How to add JS and CSS files to a backend module / best way

Kay Strobach typo3 at kay-strobach.de
Mon Apr 8 09:16:06 CEST 2013


Hi,
take a look into ext:vhs, there you'll find all you need :D

Regards
Kay

Am 08.04.13 09:09, schrieb Stefan Kruse:
> 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
> 


-- 
http://www.kay-strobach.de - Open Source Rocks

TYPO3 .... inspiring people to share!
Get involved: http://typo3.org

Answer was useful - feel free to donate:
  -
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KPM9NAV73VDF2
  - https://flattr.com/profile/kaystrobach



More information about the TYPO3-project-typo3v4mvc mailing list