How to include multiple CSS and JS files using Typoscript
You may include multiple CSS files using the following code:
page.includeCSS {
file1 = fileadmin/templates/project1/css/file1.css
file2 = fileadmin/templates/project1/css/file2.css
file3 = fileadmin/templates/project1/css/file3.css}
Use this code to include Javascript files:
page.includeJS {
file1 = fileadmin/templates/project1/js/file1.js
file2 = fileadmin/templates/project1/js/file2.js
file3 = fileadmin/templates/project1/js/file3.js}
Consider you wish to have a CSS specifically for IE 6 and below:
[version= < 7][browser = msie]
page.includeCSS.file4 = fileadmin/templates/prj1/css/ie6fix.css
[global]
Posted in Typo3

6 Comments










March 17th, 2009 at 9:12 pm
useless help to you really as any reader will see this but still:
file2 = fileadmin/templates/project1/js/file1.js
should ofcourse be file1 =
as you would otherwise overwrite this property.
March 18th, 2009 at 7:06 pm
Hey Phlunk,
Thanks for pointing out the error. I have corrected it.
December 9th, 2010 at 2:58 pm
Can anyone help me in including a php file. in this file i have a script which is to be run.. so taht whenver a page is loaded from typoscript i want dis php script to run automatically.
December 10th, 2010 at 12:30 pm
This is fairly easy. I wrote a small article that can be located here:
http://blog.chandanweb.com/typo3/how-to-include-a-custom-php-script-in-typo3
Hope that helps you.
January 24th, 2011 at 6:04 pm
I include jQuery in my base template and I want to include a jQuery plugin from ext_typoscript_setup.txt in my extension.
In this case, the plugin is included before the main library.
Can this order be changed?
Thanks
January 24th, 2011 at 7:36 pm
Yes this is possible.
If you using includeCSS then the file name is usually used to sort the order!
At present this sorting seems tricky when using includeCSS, however you may try to use the headerData method to get better control.