PHP Header files with links
Moderator: General Moderators
-
northstars23
- Forum Newbie
- Posts: 2
- Joined: Mon Aug 22, 2005 1:08 am
PHP Header files with links
I am fairly new at PHP and I started working on a site that uses includes for a header and a footer. The question that I have is that I want to link to different javascript source files depending on the page, but the links are in the header file. So, how do I define these links in the content section? I am sure this is pretty easy to do, but I haven't been able to find anything after googling for some time now.
If you will use "Switch", than every one and one of the pages will be the "index.php" with $_GET method,
example:
index.php?a=u&w=login
any page will be in the same link, so you will not have these problems.
Php.net:
http://il2.php.net/switch
good luck =]
example:
index.php?a=u&w=login
any page will be in the same link, so you will not have these problems.
Php.net:
http://il2.php.net/switch
good luck =]
- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
put these in the first lines of the page.
Code: Select all
switch ($_SERVER["PHP_SELF"]){
case "file1.php":
echo "<script type=\"text/javascript\" src=\"file1.js\"></script>";
break;
case "file2.php":
echo "<script type=\"text/javascript\" src=\"file1.js\"></script>";
break;
}