Quote:
|
Originally Posted by eyezberg
In exactly the same way.
You can name them however you want,
the important thing is just how you set the style to be used,
so when checking the page you're on, the CSS style you select accordingly
can be anything you want, as in body#sub or body#newssub or whatever..
How did you write the switch code?
|
I didnt write the code. Mr Jinx wrote it. I added the following to my template index.php file (after the head tag and replacing the body tag):
Code:
<?php include_once ("templates/hosting/template.php"); ?>
<body id="<?php echo getMenuName(); ?>">
I also created the template.php file which resides in the template folder.
Code:
?php
// $Id: template.php,v 1.0 2004/02/05 00:00:00 jjanssens Exp $
/**
* Editor handler
* @package Mambo Open Source
* @Copyright (C) 2000 - 2003 Miro International Pty Ltd
* @ All rights reserved
* @ Mambo Open Source is Free Software
* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
* @version $Revision: 1.4 $
**/
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
function getMenuName()
{
global $Itemid;
$name = getMenu($Itemid);
$name = ereg_replace('[/ ]', "", strtolower($name));
return $name;
}
function getMenu($itemid)
{
global $database;
$sql = "SELECT name FROM #__menu WHERE id='$itemid'";
$database->setQuery( $sql );
return $database->loadResult();
}
?>
and the css code is as follows:
Code:
#header {
width: 800px; height: 138px;
background: url(../images/stories/header.gif) no-repeat;
}
body#MyNews #header { background-image: url(../images/stories/header1.gif) }
body#MyDezigns #header { background-image: url(../images/stories/header2.gif) }
body#MyFamily #header { background-image: url(../images/stories/header3.gif) }
}
Now I tried what (I thought )u suggested. I have a sub menu item under My Family called
"Last Vacations" so i added the following:
Code:
body#MyFamily/LastVacations #header { background-image: url(../images/stories/header1.gif) }
....and it didn't work. I also tried just entering the submenuitem after "body#" without success. I would appreciate your help.