Jump to content


Photo

php includes


  • Please log in to reply
5 replies to this topic

#1 catfish

catfish

    Advanced Member

  • Member
  • PipPipPipPip
  • 110 posts
  • LocationVancouver Island, British Columbia, Canada

Posted 28 March 2012 - 07:52 PM

I love php includes and use this method as much as possible, however my question is when I have built a menu that uses specific styles for the active link page I don't know how to do it. My site in question in http://www.avianorganics.com The left hand menu shows the active page is a different background color. Can someone help me with the php includes for this. Thankyou

Edited by catfish, 08 September 2012 - 11:12 AM.

  • 0

#2 Wickham

Wickham

    Advanced Member

  • Advanced Member
  • PipPipPipPip
  • 1,732 posts
  • LocationSalisbury UK

Posted 29 March 2012 - 12:37 AM

This page http://www.wickham43...ghlighthome.php shows several methods.

The first item is very basic and not suitable for inclusion in an "include" file.

The second and third items are similar, for text links or image links, both using only CSS and a "matched pairs" coding. You put the li tags in the "include" file and put a different id or class to the ul tag or body tag on every page, so the id or class for the ul or body tag will only match one of the li tags on each page, changing its style. In the third item I deliberately coded it so that the About Us tab disappears on the About Us page, as it's not wanted for its own page, and only the other tabs show.

The fourth item is using PHP.

Edited by Wickham, 29 March 2012 - 12:38 AM.

  • 0

#3 catfish

catfish

    Advanced Member

  • Member
  • PipPipPipPip
  • 110 posts
  • LocationVancouver Island, British Columbia, Canada

Posted 01 April 2012 - 11:48 AM

This page http://www.wickham43...ghlighthome.php shows several methods.

The first item is very basic and not suitable for inclusion in an "include" file.

The second and third items are similar, for text links or image links, both using only CSS and a "matched pairs" coding. You put the li tags in the "include" file and put a different id or class to the ul tag or body tag on every page, so the id or class for the ul or body tag will only match one of the li tags on each page, changing its style. In the third item I deliberately coded it so that the About Us tab disappears on the About Us page, as it's not wanted for its own page, and only the other tabs show.

The fourth item is using PHP.

Thankyou, I'm going to have a look at it now...
  • 0

#4 catfish

catfish

    Advanced Member

  • Member
  • PipPipPipPip
  • 110 posts
  • LocationVancouver Island, British Columbia, Canada

Posted 08 September 2012 - 12:52 PM

This page http://www.wickham43...ghlighthome.php shows several methods.

The first item is very basic and not suitable for inclusion in an "include" file.

The second and third items are similar, for text links or image links, both using only CSS and a "matched pairs" coding. You put the li tags in the "include" file and put a different id or class to the ul tag or body tag on every page, so the id or class for the ul or body tag will only match one of the li tags on each page, changing its style. In the third item I deliberately coded it so that the About Us tab disappears on the About Us page, as it's not wanted for its own page, and only the other tabs show.

The fourth item is using PHP.


I'm just working on this now and I can't seem to make it work. What I am trying to get away from is editing every page each time a product is added or discontinued. What I am used to doing is using the include file so there is only 1 file to edit but the way I have been doing it I can't highlight my current page. It seems to me working through options 2 to 4 I need to place my page links on each page regardless and not just in an include page. My link again is http://www.avianorga...ajun_trails.php
  • 0

#5 Andrea

Andrea

    Advanced Member

  • Moderators
  • 5,718 posts
  • Facebook:https://www.facebook.com/aandbwebdesignAB
  • LocationSan Antonio, TX

Posted 08 September 2012 - 01:05 PM

Give each page a body id - for example:
<body id="indexP">
<body id="contactP">
<body id="aboutP">
in your navigation, give each item another id:
 <ul>
 	<li id="index"><a href="index.php">Home</a></li> 	
 	<li id="about"><a href="about.php">Photos</a></li>
 	<li id="contact"><a href="contact.php">Contact Us</a></li>
 	</ul>
and your CSS will be like this:

#indexP #index a, #aboutP #about a, #contactP #contact a { 	background: #aaccbc; 	color: #221523; 	}

  • 0

#6 catfish

catfish

    Advanced Member

  • Member
  • PipPipPipPip
  • 110 posts
  • LocationVancouver Island, British Columbia, Canada

Posted 15 September 2012 - 11:06 AM

Give each page a body id - for example:

<body id="indexP">
<body id="contactP">
<body id="aboutP">
in your navigation, give each item another id:
 <ul>
 	<li id="index"><a href="index.php">Home</a></li> 	
 	<li id="about"><a href="about.php">Photos</a></li>
 	<li id="contact"><a href="contact.php">Contact Us</a></li>
 	</ul>
and your CSS will be like this:

#indexP #index a, #aboutP #about a, #contactP #contact a { 	background: #aaccbc; 	color: #221523; 	}

That's fantastic. Thanks so much, I've got it now.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users