image
image

Go Back   macosx.com > Design, Media, Programming & Scripting > Design & Media

Reply
 
LinkBack Thread Tools
  #1  
Old April 19th, 2005, 10:14 AM
Browni's Avatar
Registered User
 
Join Date: Jan 2002
Location: Wantage, Oxfordshire, England
Posts: 577
Thanks: 0
Thanked 0 Times in 0 Posts
Browni is on a distinguished road
changing a css statement depending on the reuslt of $_GET['page']

I have a site tabbed navigation at the top, this is done by CSS, every tab has a off state, and an on state the on state for each tab is the same.

the content is controlled by a $_GET['page'] statement, is there a way to change the state of a tab depending on the result of $_GET['page']? for example if $_GET['page'] returns 'services' then the services tab is highlighted (with its on state) and every other tab is 'off'?

I will post an example when i iorn out a few cracks.
\
Edit: added link : http://adambrowndesigns.co.uk/dev/si....php?page=home Also how do i set it to always default to viewing home.html when i open the site?
__________________
Current Setup: G4 450 Mhz Mac OS 10.3.8 |
Adam Brown Designs

Last edited by Browni; April 19th, 2005 at 11:13 AM. Reason: Addling link
Reply With Quote
  #2  
Old April 19th, 2005, 11:02 AM
Pengu's Avatar
Digital Music Pimp
 
Join Date: Nov 2002
Location: Um.. Here.
Posts: 1,591
Thanks: 0
Thanked 0 Times in 0 Posts
Pengu is on a distinguished road
i know exactly what you want. you want to have tabs that highlight on mouse (using :hover) but also you want the current page's tab to be highlighted all the time. there isn't a way that i know of to do it, without duplication. ie: in the css file, declare another class for each tab, in the "on" state (highlighted, or whatever) and then add a string into the class="" paramater in the HTML, using a php variable..
__________________
PowerMac G5 Dual 2.0Ghz | 1Gb | 250Gb | Bluetooth | NVidia GeForce 6800 Ultra DDL 256Mb | 20" Cinema Display | MX1000 Wireless Laser Mouse | OS X 10.3.9

PowerMac G4 400Mhz | 832Mb | 40Gb + 120Gb | OS X Server 10.3.8 - Web Dev, Proxy, Mail, NAT, Firewall, Backup

Netgear Gigabit Switch | Sony Ericsson P910i Smartphone | iPod Colour 60Gb
Reply With Quote
  #3  
Old April 19th, 2005, 08:53 PM
mdnky's Avatar
[Bobs/Prog/Design:~] mod%
 
Join Date: Jul 2001
Location: Baton Rouge, LA - USA
Posts: 2,661
Thanks: 0
Thanked 1 Time in 1 Post
mdnky is on a distinguished road
Very simple to do with CSS and a simple body id tag, no PHP required.

HTML:
Code:
<body id="nav_services">

<a href="index.php?page=home" class="nav_services">Home</a>
CSS:
Code:
#nav_services #menu .nav_services {
     color: #000;
     border-top: 1px solid #666;
     border-right: 1px solid #666;
     border-bottom: 1px solid #fff;
     border-left: 1px solid #666;
     background-color: #fff;
     background-image: none;
     {
Get rid of the #menu.aactive rule when you add the one above. Change #nav_services to a unique ID for each page it's required on, and add an unique active class to each link tag in the navigation. Also, make sure that CSS rule is below every other CSS rule that deals with the navigation's styling.

You might want to consider using an unordered list to control the links better too.

CSS example for all links:
Code:
#nav_home #menu .nav_home, 
#nav_services #menu .nav_services,
#nav_support #menu .nav_support, 
#nav_itunes #menu .nav_itunes,
#nav_gallery #menu .nav_gallery, 
#nav_contact #menu .nav_contact {
     color: #000;
     border-top: 1px solid #666;
     border-right: 1px solid #666;
     border-bottom: 1px solid #fff;
     border-left: 1px solid #666;
     background-color: #fff;
     background-image: none;
     {
__________________
.
| mdnky@macosx.com | My Homepage | My Music | Restore the Pledge | MacOSX.com Widget |

• MacBook Pro Core2Duo 2.33GHz 15", 2GB DDR2 RAM, 500GB 7200RPM, DL Superdrive, OS X 10.6,
• Apple 23" Cinema HD Display, Apple Slim-Alum Keyboard, Apple BT Alum Keyboard, Logitech Optical Scroll Mouse
• iPhone 3G, iPhone 8GB, iPod Photo 30GB, Nikon D50, Nikon L6, Epson 3490, Epson R1800, HP LaserJet 1200
• LaCie 500GB d2 Quadra, LaCie 160GB d2 FW, harman/kardon SoundSticks II, Mighty Mouse, iSight


Last edited by mdnky; April 19th, 2005 at 08:59 PM.
Reply With Quote
  #4  
Old April 20th, 2005, 02:34 AM
texanpenguin's Avatar
Registered Penguin
 
Join Date: Feb 2003
Location: Australia
Posts: 881
Thanks: 0
Thanked 0 Times in 0 Posts
texanpenguin is on a distinguished road
mdnky is right about everything.

I agree about using a ul for the tab list too - it's a more sensible way to represent a list. Just make sure to use display: inline;
__________________
15" MacBook Pro
Mac OS X v10.5.1
2.33GHz, 2GB RAM, 120GB HDD

5G iPod 60GB
Reply With Quote
  #5  
Old April 20th, 2005, 02:38 AM
Browni's Avatar
Registered User
 
Join Date: Jan 2002
Location: Wantage, Oxfordshire, England
Posts: 577
Thanks: 0
Thanked 0 Times in 0 Posts
Browni is on a distinguished road
that would make it __________ as aposed to |
|
|
|
Right?
__________________
Current Setup: G4 450 Mhz Mac OS 10.3.8 |
Adam Brown Designs
Reply With Quote
  #6  
Old April 21st, 2005, 11:17 AM
mdnky's Avatar
[Bobs/Prog/Design:~] mod%
 
Join Date: Jul 2001
Location: Baton Rouge, LA - USA
Posts: 2,661
Thanks: 0
Thanked 1 Time in 1 Post
mdnky is on a distinguished road
Yea. Either display inline, or display block on the li elements with a float: left specified, will do the job (make sure to clear the float if you choose that method).
__________________
.
| mdnky@macosx.com | My Homepage | My Music | Restore the Pledge | MacOSX.com Widget |

• MacBook Pro Core2Duo 2.33GHz 15", 2GB DDR2 RAM, 500GB 7200RPM, DL Superdrive, OS X 10.6,
• Apple 23" Cinema HD Display, Apple Slim-Alum Keyboard, Apple BT Alum Keyboard, Logitech Optical Scroll Mouse
• iPhone 3G, iPhone 8GB, iPod Photo 30GB, Nikon D50, Nikon L6, Epson 3490, Epson R1800, HP LaserJet 1200
• LaCie 500GB d2 Quadra, LaCie 160GB d2 FW, harman/kardon SoundSticks II, Mighty Mouse, iSight

Reply With Quote
  #7  
Old April 21st, 2005, 11:37 AM
Browni's Avatar
Registered User
 
Join Date: Jan 2002
Location: Wantage, Oxfordshire, England
Posts: 577
Thanks: 0
Thanked 0 Times in 0 Posts
Browni is on a distinguished road
i really need to learn so me CSS and stop relying on Dreamwever to do it for me, because i have very little idea with it.
__________________
Current Setup: G4 450 Mhz Mac OS 10.3.8 |
Adam Brown Designs
Reply With Quote
  #8  
Old April 21st, 2005, 06:55 PM
mdnky's Avatar
[Bobs/Prog/Design:~] mod%
 
Join Date: Jul 2001
Location: Baton Rouge, LA - USA
Posts: 2,661
Thanks: 0
Thanked 1 Time in 1 Post
mdnky is on a distinguished road
Best way to learn it is to do it; as the more you do it, the easier it'll become. Be prepared to be annoyed for a short period while you transition over from the 'old-ways' of thinking and doing things, but that'll disappear shortly and everything will be brighter. It's kinda like switching from Windows to Mac OS X...not totally, but kinda like that.

Some books that might be worth looking into:


You can find a lot of info on the web itself. Just have to be careful who you listen to on the web sometimes.

Designer's Sites to Browse:
xHTML & CSS resource sites:
xHTML & CSS showcases:
__________________
.
| mdnky@macosx.com | My Homepage | My Music | Restore the Pledge | MacOSX.com Widget |

• MacBook Pro Core2Duo 2.33GHz 15", 2GB DDR2 RAM, 500GB 7200RPM, DL Superdrive, OS X 10.6,
• Apple 23" Cinema HD Display, Apple Slim-Alum Keyboard, Apple BT Alum Keyboard, Logitech Optical Scroll Mouse
• iPhone 3G, iPhone 8GB, iPod Photo 30GB, Nikon D50, Nikon L6, Epson 3490, Epson R1800, HP LaserJet 1200
• LaCie 500GB d2 Quadra, LaCie 160GB d2 FW, harman/kardon SoundSticks II, Mighty Mouse, iSight

Reply With Quote
Reply

Bookmarks

Thread Tools

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump


All times are GMT -5. The time now is 06:25 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC1
Copyright 2000-2010 DigitalCrowd, Inc.