Jump to content

Modifying A Called Php File Dependent Upon Page Called


vader7071

Recommended Posts

First off, thank you in advance for any help.

 

Here is what I have. I have 6 pages (Home, about us, classes, instructors, contact, and galleries).

 

On all 6 of these pages, I am using the @include("top_menu.php"); to call the menu buttons so i don't have to code them for each individual page.

 

The file "top_menu.php" looks like this:

 

<div id="menubar">

<ul id="menu">

<li><a href="index.php" title="Home">Home</a></li>

<li><a href="about.php" title="About">About Us</a></li>

<li><a href="instructors.php" title="Instructors">Instructors</a></li>

<li><a href="classes.php" title="Classes">Classes</a></li>

<li><a href="gallery.php" title="Galleries">Galleries</a></li>

<li><a href="contact.php" title="Contact">Contact Us</a></li>

</ul>

</div>

 

 

Here is what I am wanting to do. When index.php is shown, I want to modify just the "home" line to say:

 

<li><a class="current" ref="index.php" title="Home">Home</a></li>

 

When about.php is open, then modify just the line for about.php, ect.

 

My questions are:

a) can this be done?

B) is it easy?

c) can you help?

 

Thank you.

Link to comment
Share on other sites

It can be done and it's easy:

 

Add and id to the body tag for each page. For example:

 

<body id="homeP">
<body id="aboutP">
<body id="instructorsP">
<body id="classesP">
<body id="galleriesP">
<body id="contactP">

 

Then also add an id to each list item, like so:

 

<div id="menubar">
<ul id="menu">
 <li id="home"><a href="index.php" title="Home">Home</a></li>
 <li id="about"><a href="about.php" title="About">About Us</a></li>
 <li id="instructors"><a href="instructors.php" title="Instructors">Instructors</a></li>
 <li id="classes">><a href="classes.php" title="Classes">Classes</a></li>
 <li id="galleries"><a href="gallery.php" title="Galleries">Galleries</a></li>
 <li id="contact"><a href="contact.php" title="Contact">Contact Us</a></li>
</ul>
</div>

 

And in your CSS, you write:

 

#homeP #home a, #aboutP #about a, #instructorsP #instructors a, #classesP #classes a, #galleriesP #galleries a, #contactP #contact a,  { 	background: #19194c; 	color: #d5d5e6; 	 }

Link to comment
Share on other sites

That worked perfectly! Thank you for your help!

 

One more question, if I may, can I use more than 1 "id" per page? example:

 

<body id="classesP" id="basic-hgP">?

 

I have 2 menus I am modifying in this manner. The setup is "Classes" on top (which now works, thank you) and on the side will be:

 

basic handgun

intermediate handgun

advanced handgun

 

and I would like when I go to the basic handgun page, the classes tab is set and the basic handgun tab is set as well.

 

If you like, you can see the site I am working on at www.darksidev2.com/3d

Link to comment
Share on other sites

I figured it out. here is how I added it:

 

#homeP #home a, #aboutP #about a, #instructorsP #instructors a, #classesP #classes a, #galleryP #gallery a, #contactP #contact a, #basic-hgP #classes a, #int-hgP #classes a, #adv-hgP #classes a, #rifleP #classes a, #shotgunP #classes a, #selfP #classes a

{

background: #646B5C url(menu_sel.png) repeat;

}

 

#basic-hgP #basic-hg a, #int-hgP #int-hg a, #adv-hgP #adv-hg a, #rifleP #rifle a, #shotgunP #shotgun a, #selfP #self a

{

background: transparent url(arrow_select.png) no-repeat left center;

}

 

 

I went to the top menu section and added the ID's for the class pages and just triggered them to read as the "classes" page.

 

You were terrific and so helpful. Thank you so much!!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...