It is possible to inject id and class into the body tag now since some year. The code is sitting within index.php and conf.template_default.inc.php
index.php:
Code: Select all
// inject body tag in case of class or id attribute
$body_inject = '<body';
if($content['body_id'] !== false) {
if(!empty($template_default['body']['id'])) {
$body_inject .= ' id="'.$template_default['body']['id'].$content['body_id'].'"';
}
if(!empty($template_default['body']['class'])) {
$body_inject .= ' class="'.$template_default['body']['class'].$content['body_id'].'"';
}
}
Code: Select all
// this is used to inject <body> Tag by attribute "id" and/or "class"
// if value is empty '' body tag will not be injected, otherwise it will use
// current category "valueID"
$template_default['body']['id'] = 'myid_';
$template_default['body']['class'] = 'myclass_';
Now someone could need something like this: <body id="myid_11" class="myclass_45"> where 45 is the ID of the specific structure (so changing every time when moving around within the site - when jumping between the structure)
Someone else could need something like this: <body id="myid_11" class="mystructclass_42" class="myclass_45"> where 42 is the second level structure ID (below 11) and the 45 is the (changing as you move within your 42) specific ID below 42
If you have it like this you then can easily target almost anything via CSS
But not out of the box
(at least I didn't find out how)
So I did something I really am hating: fiddling with the source:
Code: Select all
// inject body tag in case of class or id attribute
$body_inject = '<body';
if($content['body_id'] !== false) {
if(!empty($template_default['body']['id'])) {
$body_inject .= ' id="'.$template_default['body']['id'].$content['body_id'].'"';
}
if(!empty($template_default['struct']['class'])) {
$body_inject .= ' class="'.$template_default['struct']['class'].$GLOBALS['LEVEL_ID'][2].'"';
}
if(!empty($template_default['body']['class'])) {
$body_inject .= ' class="'.$template_default['body']['class'].$content['cat_id'].'"';
}
}
Code: Select all
// this is used to inject <body> Tag by attribute "id" and/or "class"
// if value is empty '' body tag will not be injected, otherwise it will use
// current category "valueID"
$template_default['body']['id'] = 'myid_';
$template_default['struct']['class'] = 'mystructclass_';
$template_default['body']['class'] = 'myclass_';
Code: Select all
body#myid_11.mystructclass_42 div#extra-fix-bottom {
bottom:0;
margin-right:50%;
right:-47em;
position: fixed;
overflow: hidden;
width: 190px;
height: 137px;
background-color: #ff0000;
z-index: 15;
background: transparent url(../../pics/3-sektflaschen.png) 0px 5px no-repeat;
}
Well, as this is not so nice I'd like to know if it can be achieved out-of-the-box without changing the source, perhaps someone amongst you is knowing it better...
If not, this should perhaps become a feature...
Comments, criticism, hints, jokes, helping hands to get me back onto the right way again - all welcome
PS 1st of April is over - so I'm quite serious about that one
EDIT: It would be done better with some RT I know
EDIT: But how? Nobody online??