Members: 10,140
Threads: 38,830
Posts: 159,367
Online: 34

Newest Member: Xoote


Old 25.04.2004, 04:21   #1
darkchild
Junior Mamber
 
darkchild's Avatar
 
Join Date: Apr 2004
Location: Toronto
Posts: 25
darkchild is on a distinguished road
Default Changing Header Image Module

There was a discussion a while back regarding a dynamic header and Mr Jinx provided some code for this. I have implemented the dynamic on one of my sites. Here is a snippet of Mr Jinx's css code:
Code:
#header {
	width: 800px; height: 138px;
	background: url(../images/stories/header.gif) no-repeat;
	}
body#News  #header { background-image: url(../images/stories/header1.gif)    }
body#Music  #header { background-image: url(../images/stories/header2.gif)    }
Essentially, the item after "body#" is the menu item. Does anyone have any idea how i can add a sublevel menu item to this sequence?
__________________
darkchild is offline   Reply With Quote
Sponsored Links
Old 25.04.2004, 09:42   #2
eyezberg
Professional Mamber
 
eyezberg's Avatar
 
Join Date: Apr 2004
Location: Gap / France
Posts: 859
eyezberg is an unknown quantity at this point
Default Re: Changing Header Image Module

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?
__________________
joe / ex Mambo ex Doc Team
Eyezberg.com
eyezberg is offline   Reply With Quote
Old 25.04.2004, 14:58   #3
darkchild
Junior Mamber
 
darkchild's Avatar
 
Join Date: Apr 2004
Location: Toronto
Posts: 25
darkchild is on a distinguished road
Default Re: Changing Header Image Module

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.
__________________
darkchild is offline   Reply With Quote
Old 17.07.2004, 07:04   #4
ktizo
Baby Mamber
 
Join Date: Jul 2004
Posts: 2
ktizo is on a distinguished road
Send a message via ICQ to ktizo
Default Re: Changing Header Image Module

hi, I'm having problems with changing the header for Search. The body id registers something like this <body id="">. Can anyone help in how to insert a var in the mod_search so that the body id can register <body id="search">.
Any help would be much appreciated.
ktizo is offline   Reply With Quote
Old 17.07.2004, 10:39   #5
YTW
Junior Mamber
 
YTW's Avatar
 
Join Date: Apr 2004
Location: Madrid, Spain
Posts: 29
YTW is on a distinguished road
Default Re: Changing Header Image Module

I am not quite sure if this thread is still alive but, regarding the header switcher code of Mr Jinx:

in your css when calling the page:

1. do not use caps letter nor space
2. the script is based on a link name not the menu hierarchy. body#lastvacations

For the search issue, not quite sure to understand waht you mean. Any url to see the problem ?¿
__________________
Visit 55 Thinking and YTW

Good looking, fast & practical web sites
YTW is offline   Reply With Quote
Old 21.07.2004, 00:38   #6
kergo
Senior Mamber
 
Join Date: May 2004
Posts: 163
kergo is on a distinguished road
Default Re: Changing Header Image Module

I understand how the script is workin, but it's containing the whole <body> although it would be adequate to put the
Code:
id="<?php echo getMenuName(); ?>"
in the DIV-Tag where the header-image is (as a background-image). Or am I gettin high?
kergo is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Template -> different Header Image on specific pages Quizzer Mambo 4.5 'How Do I' Questions 8 22.06.2005 20:12
[Q] "Best" Image Gallery Component / Module? TheEdge Mambo 4.5 General Talk 7 26.08.2004 17:11
How to add an Image next to the Module Title evilfx Module 'How Do I' Questions 4 28.06.2004 23:49
How do I implement a random header image for my template formad Template Discussions 1 13.04.2004 09:05
How to change the header image in a template? ralfmarkus Mambo 4.5 'How Do I' Questions 2 09.04.2004 22:09


All times are GMT +2. The time now is 14:56.

Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
A vBSkinworks Design
© Copyright 2004-2008 by Arthur Konze Webdesign.