Page 2 of 2

Re: body IDs and classes

Posted: Sun 6. Apr 2008, 02:51
by update
pepe wrote:"das Gewehr in's Getreide"
...oder die Flinte in den Korn... :mrgreen:

Re: body IDs and classes

Posted: Mon 7. Apr 2008, 21:26
by swisscheese
Hi claus

Put this code in a frontend_render script:

Code: Select all

if(count($LEVEL_ID)) {
   foreach($LEVEL_ID as $val) $bodyclass .= $template_default['body']['class'].$val.' ';
   $content['all'] = '<div class="'.$bodyclass.'">'."\n".$content['all']."\n</div>\n";
}
Set the conf values:

Code: Select all

$template_default['body']['id'] = 'myid_';
$template_default['body']['class'] = 'myclass';
You will get a div wrapped around your whole content something like this: (where level id 10 is a sublevel of level id 2 which is a sublevel of home level id 0)

Code: Select all

<body id="myid_10" class="myclass_10> <!--this comes out of the box-->
<div class="myclass_0 myclass_2 myclass_10 "> <!-- this comes from frontend_render-->
...content...
</div>
</body>
You are able to set css stuff for a specific level with all the sublevels (eg .myclass_2 p {background:red;})

have fun, swisscheese

Re: body IDs and classes

Posted: Mon 7. Apr 2008, 21:45
by update
Thank you :)

Re: body IDs and classes

Posted: Mon 7. Apr 2008, 21:52
by Jensensen
Hi swisscheese,

[btw.: i like it very well]

as you mentioned above, this does not affect --> body tag.
but might be a good idea, anyway. :wink:

So, in addition for this approach CSS can / could / would be:
body#myid_10 div.myclass_0.myclass_2.myclass_10 { styles: here; }
and so on...

or even:
body#myid_10.myclass_10 div.myclass_0.myclass_2.myclass_10 { styles: here; }


for those, who work it this way.

Re: body IDs and classes

Posted: Mon 7. Apr 2008, 22:07
by swisscheese
Jensensen wrote: as you mentioned above, this does not affect --> body tag.
yep. couldn't find a way to inject body tag with frontend_render. So you'll get this div tag, but this shouldn't be a problem...
body#myid_10.myclass_10 div.myclass_0.myclass_2.myclass_10 { styles: here; }
nope! so you will only affect level id 10 whithout any sublevel (and here #myid_10 {styles: here} would be enough code...) :wink:
if you want affect a whole tree under a certain level, you would put in your css .myclass_2 {styles: here;} This way, the level id 2 AND ALL levels, sublevels, subsublevels... will be affected

have fun, swisscheese

Re: body IDs and classes

Posted: Tue 8. Apr 2008, 00:03
by Jensensen
x