•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,705 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,191 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1127 | Replies: 0
![]() |
•
•
Join Date: Dec 2005
Location: Malaysia...Truly Asia!
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
I know it sounds confusing but I will try my best to explain what I really mean.
Here is part of my css code:
And my navigation bar at http://ibnuasad.org
The navigation code is located at index.html. I want to move the code to a separate file called navigation.php and I would place <?php include("navigation.php") ?> in my index.html file.
Here's the problem:
I want to make something like when I go to index.html I want the "Welcome" text to use the activenavitab style. But when I go to downloads.html I want the "Downloads" text to use the style activenavitab and make the "Welcome" text use the "navitab" style.
Note that I will also be using the code <?php include("navigation.php") ?> in the downloads.html file
Anyone knows how to this?
Btw, I was not sure where to post this thread cause it involves CSS, HTML and PHP
EDIT:
Someone had give me the code
[PHP]<?php
$l[0][0] = "index.html";
$l[0][1] = "Welcome";
$l[1][0] = "bio.html";
$l[1][1] = "Bio";
$l[2][0] = "contact-page.html";
$l[2][1] = "Contact Me";
$l[3][0] = "gallery.html";
$l[3][1] = "Gallery";
$thispage = $_SERVER['SCRIPT_NAME'];
$arr = explode("/", $thispage);
$page = strtolower($arr[2]);
?>
<?php
$i = 0;
while ($l[$i] != "") {
if (strtolower(str_replace(" ", "", $l[$i][0])) == $page) {
echo "<a class=\"activenavitab\" href=\"" . $l[$i][0] . "\">" . $l[$i][1] . "</a>"; }
else {
echo "<a class=\"navitab\" href=\"" . $l[$i][0] . "\">" . $l[$i][1] . "</a>"; }
$i++;
}
?> [/PHP]
But it still wont show the activenavitab style...I have placed the code into navigation.php and implement it on http://ibnuasad.org/bio.html
Can someone please help me
I'm still a php newbie
Here is part of my css code:
.navitab {
padding: 4px 8px 4px 8px;
margin: 0 0 4px 0;
text-decoration: none;
letter-spacing: 1px;
background: #e0e0e0 url(images/corner.gif) top right no-repeat;
border-bottom: 1px solid #ffffff;
border-left: 1px solid #ffffff;
}
.activenavitab {
padding: 4px 8px 5px 8px;
color: #ffffff;
margin: 0 0 5px 0;
text-decoration: none;
background: #505050 url(images/corner.gif) top right no-repeat;
}And my navigation bar at http://ibnuasad.org
<div id="navitabs"> <h2 class="hide">Site menu:</h2> <a class="activenavitab" href="index.html">Welcome</a><span class="hide"> | </span> <a class="navitab" href="#">Bio</a><span class="hide"> | </span> <a class="navitab" href="#">Discography</a><span class="hide"> | </span> <a class="navitab" href="#">Downloads</a><span class="hide"> | </span> <a class="navitab" href="#">Photos</a><span class="hide"> | </span> <a class="navitab" href="#">Tour</a><span class="hide"> | </span> <a class="navitab" href="#">Merchandise</a><span class="hide"> | </span> <a class="navitab" href="#">Interviews</a> </div>
The navigation code is located at index.html. I want to move the code to a separate file called navigation.php and I would place <?php include("navigation.php") ?> in my index.html file.
Here's the problem:
I want to make something like when I go to index.html I want the "Welcome" text to use the activenavitab style. But when I go to downloads.html I want the "Downloads" text to use the style activenavitab and make the "Welcome" text use the "navitab" style.
Note that I will also be using the code <?php include("navigation.php") ?> in the downloads.html file
Anyone knows how to this?
Btw, I was not sure where to post this thread cause it involves CSS, HTML and PHP
EDIT:
Someone had give me the code
[PHP]<?php
$l[0][0] = "index.html";
$l[0][1] = "Welcome";
$l[1][0] = "bio.html";
$l[1][1] = "Bio";
$l[2][0] = "contact-page.html";
$l[2][1] = "Contact Me";
$l[3][0] = "gallery.html";
$l[3][1] = "Gallery";
$thispage = $_SERVER['SCRIPT_NAME'];
$arr = explode("/", $thispage);
$page = strtolower($arr[2]);
?>
<?php
$i = 0;
while ($l[$i] != "") {
if (strtolower(str_replace(" ", "", $l[$i][0])) == $page) {
echo "<a class=\"activenavitab\" href=\"" . $l[$i][0] . "\">" . $l[$i][1] . "</a>"; }
else {
echo "<a class=\"navitab\" href=\"" . $l[$i][0] . "\">" . $l[$i][1] . "</a>"; }
$i++;
}
?> [/PHP]
But it still wont show the activenavitab style...I have placed the code into navigation.php and implement it on http://ibnuasad.org/bio.html
Can someone please help me
I'm still a php newbie
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
- Database and web design (MySQL)
- Need Developer: mysql and associated pages (Web Development Job Offers)
- non-static and variable errors (Java)
- Optimum Online Web Hosting. (Networking Hardware Configuration)
- making a registration page (HTML and CSS)
- How to get value of selected dynamic checkboxes? (ASP.NET)
- Need a new powersupply (Cases, Fans and Power Supplies)
- Is it the Flyback Transformer? (Troubleshooting Dead Machines)
Other Threads in the PHP Forum
- Previous Thread: Fatal Error
- Next Thread: OpenSource Project


Linear Mode