I am trying to include my cascading style sheet into my TYPO3 extension. I created the extension with "kickstarter". This is the way I tried to include it:
$this->doc->getPageRenderer()->addCssFile(t3lib_extMgm::extRelPath('myExt') . 'res/css/my_stylesheet.css');
I added that line at the end of the main()
method.
So what am I doing wrong? The path including the file does definately exist.
Thank you.
And if You would like to include CSS file in other module than Yours, without to modify it, You could use $TBE_STYLES array.
ext_tables.php:
// Custom CSS include
if (TYPO3_MODE=="BE") {
$TBE_STYLES['inDocStyles_TBEstyle'] .= '@import "/typo3conf/ext/your_ext/res/css/your.css";';
}
Ok, I could finally solve the problem.
When adding the code right after instancing the "doc" object, everything works fine.
$this->doc = t3lib_div::makeInstance('mediumDoc');
$this->doc->getPageRenderer()->addCssFile(t3lib_extMgm::extRelPath('myExt') . 'res/css/my_stylesheet.css');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With