Welcome,
Guest
.
Please
login
or
register
.
Did you miss your
activation email
?
News:
Convert
Wordpress to Elxis
with
Elxis importer
!
Home
Help
Login
Register
Elxis CMS Forum
»
Extensions
»
Templates
(Moderators:
Coursar
,
ks-net
) »
changing bg image in div every time you call different menu link
« previous
next »
Print
Pages: [
1
]
Author
Topic: changing bg image in div every time you call different menu link (Read 11933 times)
babis1
Hero Member
Posts: 1538
changing bg image in div every time you call different menu link
«
on:
October 06, 2010, 10:18:51 »
i have a <div id="header"> with css background: url(../images/logo.jpg) no-repeat top; now i need to change the image every time when i call different menu links-items (in pe 5 different links-items).................................
thanks !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: changing bg image in div every time you call different menu link
«
Reply #1 on:
October 06, 2010, 18:35:00 »
Replace this: <div id="header">
with something like this:
<?php
switch ($Itemid) {
case 2: $sfx = '-1'; break;
case 7: $sfx = '-2'; break;
case 19: $sfx = '-3'; break;
default: $sfx = ''; break;
}
?>
<div class="header<?php echo $sfx; ?>">
Now, on your template's css file add these classes (off course change the CSS to you want):
.header-1 {background-color: #ff9900; }
.header-2 {background-color: #ff0000; }
.header-3 {background-color: yellow; }
.header {background-color: #ddd; }
2, 7 and 19 are sample Itemid's. Put your own before the "default" statement. You can give any suffix you want, I used "-1, -2, -3" as a sample. You can also add any number of them. The "header" class is the default one.
Recommendation: Do not use ID everywhere. Id should be used on very special elements. Use CSS classes instead.
«
Last Edit: October 06, 2010, 18:36:59 by datahell
»
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
babis1
Hero Member
Posts: 1538
Re: changing bg image in div every time you call different menu link
«
Reply #2 on:
October 06, 2010, 18:39:48 »
<?php
switch ($Itemid) {
case 2: $sfx = '-1'; break;
case 7: $sfx = '-2'; break;
case 19: $sfx = '-3'; break;
default: $sfx = ''; break;
}
?>
that code goes before </head> ?
Logged
webgift
Elxis Team
Hero Member
Posts: 4193
Re: changing bg image in div every time you call different menu link
«
Reply #3 on:
October 06, 2010, 18:41:43 »
Just before the <div class="header<?php echo $sfx; ?>">
Logged
Elxis Team •
Custom web design [EN]
-
[EL]
•
.GR Registrar
babis1
Hero Member
Posts: 1538
Re: changing bg image in div every time you call different menu link
«
Reply #4 on:
October 06, 2010, 18:42:22 »
ok thanks a lot i go to try it
--------after----------------------------
ok it works fine !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! i need it only for 5 items, because there i cant have module position
«
Last Edit: October 06, 2010, 18:52:11 by babis1
»
Logged
babis1
Hero Member
Posts: 1538
Re: changing bg image in div every time you call different menu link
«
Reply #5 on:
October 20, 2010, 10:40:54 »
ok another one if i want to use the same img in more than one items pe case 2,29,30.....
Logged
webgift
Elxis Team
Hero Member
Posts: 4193
Re: changing bg image in div every time you call different menu link
«
Reply #6 on:
October 20, 2010, 11:45:17 »
<?php
switch ($Itemid) {
case 2: $sfx = '-5'; break;
case 29: $sfx = '-5'; break;
case 30: $sfx = '-5'; break;
default: $sfx = ''; break;
}
?>
<div class="header<?php echo $sfx; ?>">
css file:
.header-5 {background: #ff9900 url(../images/my_image.jpg) no-repeat 0 0; }
«
Last Edit: October 20, 2010, 11:51:49 by WebGift
»
Logged
Elxis Team •
Custom web design [EN]
-
[EL]
•
.GR Registrar
Amigamerlin
Sr. Member
Posts: 358
Re: changing bg image in div every time you call different menu link
«
Reply #7 on:
October 20, 2010, 12:00:17 »
This board is simply fantastic !!! A lot of learning thing here. Thank you you all for all the time you reserve to ELXIS !!
Ciao
Logged
ArXoS
Hero Member
Posts: 796
Re: changing bg image in div every time you call different menu link
«
Reply #8 on:
November 04, 2010, 00:01:45 »
bookmarked
Logged
Powered by Elxis :
www.greekmasa.gr
|
gym-mous-alim.att.sch.gr
ahmet
Sr. Member
Posts: 283
360 HDR Virtual Tours | Windsurfing Sailing
Re: changing bg image in div every time you call different menu link
«
Reply #9 on:
January 05, 2012, 20:05:46 »
book marked also..
thats why we have to know php or java
the power of php..
Logged
www.puretourism.co.uk
www.globalpanorama.net
www.bodrumwindsurf.com
Print
Pages: [
1
]
« previous
next »
Elxis CMS Forum
»
Extensions
»
Templates
(Moderators:
Coursar
,
ks-net
) »
changing bg image in div every time you call different menu link