
I will give it a try!
Code: Select all
<?php
/*
just a sample how to inject body ID - i.e. to allow specific CSS based things (or JavaScript stuff too)....
if you define $content['body_id'] = FALSE body tag injection will be hopped
sample will set body tag injection based on "main structure"
if it is in home it will fall back to
*/
if(isset($LEVEL_ID[1])) { // lets say it is the main structure root
$content['body_id'] = $LEVEL_ID[1];
{
if(isset($LEVEL_ID[3])) { // lets say it is the third structure level
$content['body_id'] = $LEVEL_ID[3];
}
}
} else { // do nothing
$content['body_id'] = false;
}
?>
Code: Select all
//define the current article category ID
$content["cat_id"] = $aktion[0];
//try to find current tree depth
$LEVEL_ID = array();
$LEVEL_KEY = array();
$LEVEL_STRUCT = array();
$level_ID_array = get_breadcrumb($content["cat_id"], $content['struct']);
$level_count = 0;
foreach($level_ID_array as $key => $value) {
$LEVEL_ID[$level_count] = $key;
$LEVEL_KEY[$key] = $level_count;
$LEVEL_STRUCT[$level_count] = $content['struct'][$key]['acat_name'];
if($PERMIT_ACCESS && $content['struct'][$key]['acat_regonly']) {
$PERMIT_ACCESS = false; // only users have been logged in get access
}
$level_count++;
}
$content['body_id'] = $LEVEL_ID;
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']['class'])) {
$body_inject .= ' class="';
foreach($content['body_id'] as $val) $body_inject.=$template_default['body']['class'].$val.' ';
$body_inject .='"';
}
if(!empty($template_default['body']['id'])) {
$body_inject .= ' id="'.$template_default['body']['id'].array_pop($content['body_id']).'"'; #gm#
}
}
$content['page_start'] .= $body_inject.'>'.LF;
Code: Select all
$template_default['body']['id'] = 'myid_';
$template_default['body']['class'] = 'myclass';
Code: Select all
<body class="myclass_0 myclass_3 myclass_11 " id="myid_11">
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";
}
Code: Select all
$template_default['body']['id'] = '';
$template_default['body']['class'] = '';
Code: Select all
$content['body_id'] = '';