Franz Holzinger

Verse of the day

Seid aber Täter des Worts und nicht Hörer allein, wodurch ihr euch selbst betrügt.
Jakobus 1:22

© Bible Gateway's Verse of the Day

16-03-11 14:30:38 Several inclusions of the same css file in html
Julia Pekkonen
Hello Franz and all!
I have several instances tt_products on my page (basket, single view, list view, category menu, etc.) - total 7.
In my root page I have this TS in setup:
CSS.ALL.file = fileadmin/templates/css/tt_products.css
And include static template (Shop system CSS slyled).
All work properly, but in HTML page I find 7 (seven) pcs. of my tt_products.css placed in HTML.
Each instance of tt_products place in HTML something like this:
<div id="basket_overview">
<!-- CONTENT ELEMENT, uid:94/list [begin] -->
<div id="c94" class="csc-default" >
<!-- Plugin inserted: [begin] -->
<style type="text/css">

Please clarify how I can include CSS for tt_products ONLY 1 time and as link in HTML header:
<link rel="stylesheet" type="text/css" href="fileadmin/templates/css/tt_products.css" media="all">

Thanks in advance!
16-03-11 22:27:56 Yes it work!
Julia Pekkonen
Thank Franz!
16-03-11 20:18:00 Solution?
Julia Pekkonen

Thanks Franz.
I understand that in my situation I have only one solution?
CSS.ALL.file = fileadmin/templates/css/tt_products.css

Include css like other css files:
page.stylesheet= fileadmin/templates/css/tt_products.css
16-03-11 20:07:53 tt_products 2.6.6
Franz Holzinger
Unfortunaltely the CSS setup is not implemented in tt_products 2.6.6. The code modification above is for tt_products 2.9.1.


page = PAGE
page.stylesheet= fileadmin/templates/css/tt_products.css

Check your PAGE setup. You can add the stylesheet file there for your pages with tt_products.

16-03-11 19:56:53 add or change
Franz Holzinger
Hello Julia,

some lines must be added to the files. And some lines need a modification.
In class.tx_ttproducts_main.php you will find similar lines. You must make a modification.

In class.tx_ttproducts_css.php everything must be added.
16-03-11 18:27:25 Problem with modification
Julia Pekkonen
Hello Franz.
Thank for your reply!
I checked my files: control/class.tx_ttproducts_main.php & lib/class.tx_ttproducts_css.php but not find necessary lines.
Or I need ADD your lines in files, if yes - where exactly?
Maybe problem is that I use tt_products 2.6.6?
16-03-11 18:04:39 Code modification
Franz Holzinger
Hello Julia,

I did not think so far. You are right with your comment.
tt_products needs a modification here.

File control/class.tx_ttproducts_main.php:

$cssObj = &t3lib_div::getUserObj('&tx_ttproducts_css');
if ($cssObj->isCSSStyled() && !$cssObj->getIncluded()) {
$rc = '<style type="text/css">'.$this->cObj->fileResource($cssObj->conf['file']).'</style>'.chr(13).$content;
} else {
$rc = $content;

file lib/class.tx_ttproducts_css.php:

private $bIncluded = FALSE;

public function setIncluded () {
$this->bIncluded = TRUE;

public function getIncluded () {
return $this->bIncluded;

Try it with this and tell me.
< Zurück zum Forum