attila2452 Posted July 24, 2009 Report Share Posted July 24, 2009 ok so this is my website: http://attilahajzer.comli.com/so i have my Top nav and then content.to display my content i am using the INCLUDE function.this is what it looks like. <?php if (file_exists("" . $_GET["page"].".php")) {include("".$_GET["page"] . ".php");} elseif($_GET["page"] == "") {include("welcome.php");}?> my navigation links are:Home (welcome)AboutMediaDownloadsContactGuestbookInside of MEDIA i have four pages:MusicImagesAlbumsLinksand then i have an image under that. well my issue that i am trying to resolve is can i have an include function inside of an include function?Objective:I want Media to have its own Include Function to use for the pages:MusicImagesAlbumsLinksthis is what i tried to use: <?php if (file_exists("" . $_GET["med"]. ".php")) {include("" .$_GET["med"] .".php");} elseif($_GET["pages"] === "") {include("cover.php");}?> Please Help me! Link to comment Share on other sites More sharing options...
justsomeguy Posted July 24, 2009 Report Share Posted July 24, 2009 You can use include in any PHP file, if you want the include file for the media page to have another include statement, that's fine. Link to comment Share on other sites More sharing options...
attila2452 Posted July 24, 2009 Author Report Share Posted July 24, 2009 You can use include in any PHP file, if you want the include file for the media page to have another include statement, that's fine.ok so i have changed up the include code on Media to look like this:<?php if (file_exists("" . $_GET["page"]. ".php")) {include("" .$_GET["page"] .".php");} elseif($_GET["page"] == ""){include("cover.php");}?> But something isn't working right because that is repeating the four links downwards endlessly. could you help me write the proper include function for this part please? Link to comment Share on other sites More sharing options...
Guest FirefoxRocks Posted July 24, 2009 Report Share Posted July 24, 2009 What's the contents of the files that you included, and you can use require_once instead of include to do it once only if you're concerned about that. Link to comment Share on other sites More sharing options...
attila2452 Posted July 24, 2009 Author Report Share Posted July 24, 2009 What's the contents of the files that you included, and you can use require_once instead of include to do it once only if you're concerned about that.ok so i am now using require once. and now what is happening when i cick those links it brings me to the page but then the links disssappear. like im assuming it should. then i try to change it to Require, but that does the same as included did.i want it to act like an iFrame but using PHP. with the require or include function so i can use tabs. I really want to use PHP. Link to comment Share on other sites More sharing options...
Guest FirefoxRocks Posted July 24, 2009 Report Share Posted July 24, 2009 Can you post the source of both PHP pages? Link to comment Share on other sites More sharing options...
attila2452 Posted July 24, 2009 Author Report Share Posted July 24, 2009 Can you post the source of both PHP pages?INDEX<!DOCTYPE HTML PUBLIC "-//W3C//Dli HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dli"><html><title><?php if($_GET["page"] == ""){echo 'Attila Hajzer - Home';} if($_GET["page"] === "about"){echo 'Attila Hajzer - About';} if($_GET["page"] === "albums"){echo 'Attila Hajzer - Albums';} if($_GET["page"] === "contact"){echo 'Attila Hajzer - Contact';} if($_GET["page"] === "downloads"){echo 'Attila Hajzer - Downloads';} if($_GET["page"] === "guestbook"){echo 'Attila Hajzer - Guestbook';} if($_GET["page"] === "images"){echo 'Attila Hajzer - Images';} if($_GET["page"] === "images2"){echo 'Attila Hajzer - Images';} if($_GET["page"] === "links"){echo 'Attila Hajzer - Links';} if($_GET["page"] === "media"){echo 'Attila Hajzer - Media';} if($_GET["page"] === "music"){echo 'Attila Hajzer - Music';} if($_GET["page"] === "subscribe"){echo 'Attila Hajzer - Mailing List';} if($_GET["page"] === "support"){echo 'Attila Hajzer - Support';} if($_GET["page"] === "updates"){echo 'Attila Hajzer - News';} if($_GET["page"] === "welcome"){echo 'Attila Hajzer - Home';} if($_GET["page"] === "widgets"){echo 'Attila Hajzer - Widgets';}?></title><head><meta name="description" content="Webite Designs" /><link rel="stylesheet" type="text/css" href="default.css" /><link rel="stylesheet" type="text/css" href="style.css" /></head><body bgcolor="#F8F8F8"><div id="container"> <div id="top"> <div style="text-align: right;"><font color=""><?php echo date("l, F j, Y"); ?></div> <h1 class="heading">A light breeze</font></h1> <!-- <div id="form"> <form action="google.ca" method="get"> <input type="text" name="Search" value size="15" /> <input type="submit" value="Search" /> </form> </div> <br /> <br /> --> </div> <div id="background"> <div id="wrapper"> <div id="navigation"> <ul> <?php if($_GET["page"] == ""){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=welcome'><font color='#87CEEB'>  Home  </font></a></li>"; }elseif($_GET["page"] === "welcome"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=welcome'><font color='#87CEEB'>  Home  </font></a></li>"; }else{ echo"<li><a href='?page=welcome'>  Home  </a></li>"; } if($_GET["page"] === "about"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=about'><font color='#87CEEB'>  About  </font></a></li>"; }else{ echo"<li><a href='?page=about'>  About  </a></li>"; } if($_GET["page"] === "media"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "music"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "images"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "images2"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "albums"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "links"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "widgets"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }else{ echo"<li><a href='?page=media'>  Media  </a></li>"; } if($_GET["page"] === "downloads"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=downloads'><font color='#87CEEB'>  Downloads  </font></a></li>"; }else{ echo"<li><a href='?page=downloads'>  Downloads  </a></li>"; } if($_GET["page"] === "contact"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=contact'><font color='#87CEEB'>  Contact  </font></a></li>"; }else{ echo"<li><a href='?page=contact'>  Contact  </a></li>"; } if($_GET["page"] === "guestbook"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=guestbook'><font color='#87CEEB'>  Guestbook  </a></li>"; }else{ echo"<li><a href='?page=guestbook'>  Guestbook  </a></li>"; } ?><i><b><font color="#409df9"> <?php $num = Rand (1,6); switch ($num) { case 1: echo "Keep your head up"; break; case 2: echo "The greater the difficulty, the greater the glory"; break; case 3: echo "Stay in school!"; break; case 4: echo "Drinking and driving don't mix"; break; case 5: echo "Tomorrow is another day"; break; case 6: echo "Learn to face the music!"; } ?></font></i></b> </ul> </div> </div><?php if (file_exists("" . $_GET["page"].".php")) {include("".$_GET["page"] . ".php");} elseif($_GET["page"] == "") {include("welcome.php");}?> </div></div><center> <ul id="foot"> <li><a href="?page=welcome">Home</a> |</li> <li><a href="?page=about">About</a> |</li> <li><a href="?page=media">Media</a> |</li> <li><a href="?page=downloads">Downloads</a> |</li> <li><a href="?page=support">Support</a> | </li> <li><font color="#409df9">Copyright © 2009 Attila Hajzer - All Rights Reserved</font></li> </ul></center></body></html> MEDIA <html><head><link rel="stylesheet" type="text/css" href="default.css" /><link rel="stylesheet" type="text/css" href="style.css" /></head><body><center> <ul id="media"> <li>  <a href="?page=music">Music</a>  </li> <li>  <a href="?page=images">Images</a>  </li> <li>  <a href="?page=albums">Albums</a>  </li> <li>  <a href="?page=links">Links</a>  </li> </ul> </center><?php if (file_exists("" . $_GET["page"]. ".php")) { require_once("" .$_GET["page"] .".php");} elseif($_GET["page"] == ""){include("cover.php");}?><center> <img src="images/Cover.JPG" border="0" align="center" valign="middle"/> </center></body></html> Link to comment Share on other sites More sharing options...
alexnofue Posted July 24, 2009 Report Share Posted July 24, 2009 Hi, there is a lot in this code that needs workthere are font, center and other deprecated tags, they must be replaced with stylesalso the title tag must be inside the head tagthe title could have much cleaner code if put inside a switch as they are checking on a sole variable.the same goes for the navigation list.the links might be disappearing if the $_GET['page'] is not set, you should try to: print_r($_GET); to see if there is the page variable when the links disappear Link to comment Share on other sites More sharing options...
attila2452 Posted July 24, 2009 Author Report Share Posted July 24, 2009 Hi, there is a lot in this code that needs workthere are font, center and other deprecated tags, they must be replaced with stylesalso the title tag must be inside the head tagthe title could have much cleaner code if put inside a switch as they are checking on a sole variable.the same goes for the navigation list.the links might be disappearing if the $_GET['page'] is not set, you should try to: print_r($_GET); to see if there is the page variable when the links disappearok so first of all lets do this in order. how could I do the title with less coding. Link to comment Share on other sites More sharing options...
morrisjohnny Posted July 24, 2009 Report Share Posted July 24, 2009 (edited) ok so first of all lets do this in order. how could I do the title with less coding.I'm guessing you had planned on working your way through AlexNoFue list? well he's a quick little suggestion list however their are a number of ways things can be done. and theses are just ideas and other people may suggest other ways.Hi, there is a lot in this code that needs workYou could use an include file (this will then still exicute the code and will make your file easier and shorter to work with.there are font, center and other deprecated tags, they must be replaced with stylesThis is something you have to work on, learning CSS and using appropriate styling would help (the <font> tag being the most important here remove it and using style="" or a CSS Sheet.also the title tag must be inside the head tagjust pop this <head> below <html> then that's the simple one fixed (since you closed it but never open it)the title could have much cleaner code if put inside a switch as they are checking on a sole variable.the same goes for the navigation list.i don't know the switch but including that code in an external file and calling it would also do the trick. Edited July 24, 2009 by morrisjohnny Link to comment Share on other sites More sharing options...
attila2452 Posted July 24, 2009 Author Report Share Posted July 24, 2009 ok so ive done the majority of it.cleaned up my code and now im left with this : the title could have much cleaner code if put inside a switch as they are checking on a sole variable.the same goes for the navigation list.the links might be disappearing if the $_GET['page'] is not set, you should try to: print_r($_GET); to see if there is the page variable when the links disappearany one have any suggestions on that? Link to comment Share on other sites More sharing options...
justsomeguy Posted July 24, 2009 Report Share Posted July 24, 2009 (edited) This is an example of a switch: switch($_GET['page']){ case 'about': echo 'About'; break; case 'albums': echo 'Albums'; break; case 'contact': echo 'Contact'; break; default: echo 'Page was empty'; break;} You can condense it if you want to: switch($_GET['page']){ case 'about': echo 'About'; break; case 'albums': echo 'Albums'; break; case 'contact': echo 'Contact'; break; default: echo 'Page was empty'; break;} If you want to figure out why your include files are giving you problems, just walk through your code. If $_GET['page'] is "media", walk though your code and look at the if statements to figure out what you're telling the code to do when the page is media. I've worked through several algorithms with a pencil and paper to keep track of variable values to figure out where problems are. Edited July 24, 2009 by justsomeguy Link to comment Share on other sites More sharing options...
attila2452 Posted July 24, 2009 Author Report Share Posted July 24, 2009 (edited) This is an example of a switch:switch($_GET['page']){ case 'about': echo 'About'; break; case 'albums': echo 'Albums'; break; case 'contact': echo 'Contact'; break; default: echo 'Page was empty'; break;} You can condense it if you want to: switch($_GET['page']){ case 'about': echo 'About'; break; case 'albums': echo 'Albums'; break; case 'contact': echo 'Contact'; break; default: echo 'Page was empty'; break;} If you want to figure out why your include files are giving you problems, just walk through your code. If $_GET['page'] is "media", walk though your code and look at the if statements to figure out what you're telling the code to do when the page is media. I've worked through several algorithms with a pencil and paper to keep track of variable values to figure out where problems are. so i replaced my old code with the one you suggested. and it looks cleaner. but one thing. thats is a lot of things going on in my Index file. is there a way i can lighen up the load? like make a file juist for the title and call that in my title tag? (also with my quote) : <?php $num = Rand (1,6); switch ($num) { case 1: echo "Keep your head up"; break; case 2: echo "The greater the difficulty, the greater the glory"; break; case 3: echo "Stay in school!"; break; case 4: echo "Drinking and driving don't mix"; break; case 5: echo "Tomorrow is another day"; break; case 6: echo "Learn to face the music!"; } ?> so yeah,lets just say for my quote i want a new file and call that onto my index how would i go about doing that? Edited July 24, 2009 by Attila2452 Link to comment Share on other sites More sharing options...
morrisjohnny Posted July 24, 2009 Report Share Posted July 24, 2009 quote.php <?php $num = Rand (1,6); switch ($num) { case 1: echo "Keep your head up"; break; case 2: echo "The greater the difficulty, the greater the glory"; break; case 3: echo "Stay in school!"; break; case 4: echo "Drinking and driving don't mix"; break; case 5: echo "Tomorrow is another day"; break; case 6: echo "Learn to face the music!"; } ?> in your index file where the current code is add <?php require"quote.php" ?> then that should work. same for the title if you want to do the same. Link to comment Share on other sites More sharing options...
attila2452 Posted July 24, 2009 Author Report Share Posted July 24, 2009 quote.php <?php $num = Rand (1,6); switch ($num) { case 1: echo "Keep your head up"; break; case 2: echo "The greater the difficulty, the greater the glory"; break; case 3: echo "Stay in school!"; break; case 4: echo "Drinking and driving don't mix"; break; case 5: echo "Tomorrow is another day"; break; case 6: echo "Learn to face the music!"; } ?> in your index file where the current code is add <?php require"quote.php" ?> then that should work. same for the title if you want to do the same. Thank you sooo much! it worked!. but a few questions, why Require, how is it different from Require_Once, Include and Include_Once? Link to comment Share on other sites More sharing options...
morrisjohnny Posted July 24, 2009 Report Share Posted July 24, 2009 from my understanding essentially, there is no difference. With "include", if the file being included is not found processing continues without error. If you use "require" and the file is not found, your PHP script will get a 'fatal error' and all processing will stop. However i would probably change require to require_once as you are only going to use the script once for each page load. Link to comment Share on other sites More sharing options...
attila2452 Posted July 24, 2009 Author Report Share Posted July 24, 2009 ok now that i got that, whats the difference between echo, print, and Print_randfor print_r is there more letter and does the letter in the end mean anything? Link to comment Share on other sites More sharing options...
morrisjohnny Posted July 24, 2009 Report Share Posted July 24, 2009 try using the manual on the php websiteHere's the link for print_r that is the place place to look up things or using google. Link to comment Share on other sites More sharing options...
attila2452 Posted July 24, 2009 Author Report Share Posted July 24, 2009 I still need help with my include file in media. i want it to be like an iframe but in PHP.this is how i have my Index file! <?php if (file_exists("" . $_GET["page"] . ".php")) {include("" . $_GET["page"] . ".php");} elseif($_GET["page"] == "") {include("welcome.php");}?> welcome.php is the default first page.and when you click in the nav, it uses that include function to view the other pages.well in my media i have an include function and i want it to work the same way, because it has its own navigation and i want that navigation to use that include function (which is in the index's include function.this is my media page. <html><head><link rel="stylesheet" type="text/css" href="default.css" /><link rel="stylesheet" type="text/css" href="style.css" /></head><body><ul id="media"> <li>Â Â <a href="?page=music">Music</a>Â Â </li> <li>Â Â <a href="?page=images">Images</a>Â Â </li> <li>Â Â <a href="?page=albums">Albums</a>Â Â </li> <li>Â Â <a href="?page=links">Links</a>Â Â </li> </ul><?php if (file_exists("" . $_GET["page"] . ".php")) {require_once("" . $_GET["page"] .".php");} elseif($_GET["page"] == "") {include("cover.php");}?></body></html> the reason i am using Require_once is because if i use include, it repeats my Media-Nav endlessly. i do not know how to fix this. so any suggestions? Link to comment Share on other sites More sharing options...
Guest FirefoxRocks Posted July 24, 2009 Report Share Posted July 24, 2009 (edited) Try this for your index.php file: <?php if(isset($_GET["page"]) && !empty($_GET["page"]) && is_string($_GET["page"])) if (file_exists("" . $_GET["page"] . ".php")) { header("Location: " . $_GET["page"] . ".php"); } else { header("Location: welcome.php"); } else { header("Location: welcome.php"); }?> Edited July 24, 2009 by FirefoxRocks Link to comment Share on other sites More sharing options...
attila2452 Posted July 24, 2009 Author Report Share Posted July 24, 2009 Try this for your index.php file:<?php if(isset($_GET["page"]) && !empty($_GET["page"]) && is_string($_GET["page"])) if (file_exists("" . $_GET["page"] . ".php")) { header("Location: " . $_GET["page"] . ".php"); } else { header("Location: welcome.php"); } else { header("Location: welcome.php"); }?> ok so i tried it and all it displayed was welcome.phpbut i think thats because your assuming that my index file is using includes and requires for nav and everything.this is my entire index file before editing:<!DOCTYPE HTML PUBLIC "-//W3C//Dli HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dli"><html><head><title>Attila Hajzer - <?php require_once'title.php' ?></title><meta name="description" content="Webite Designs" /><link rel="stylesheet" type="text/css" href="default.css" /><link rel="stylesheet" type="text/css" href="style.css" /></head><body bgcolor="#F8F8F8"><div id="container"> <div id="top"> <h1 class="heading">A light breeze</font></h1> <div id="date"><?php echo date("l, F j, Y"); ?></div> </div> <div id="background"> <div id="wrapper"> <div id="navigation"> <ul> <?php if($_GET["page"] == ""){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=welcome'><font color='#87CEEB'>  Home  </font></a></li>"; }elseif($_GET["page"] === "welcome"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=welcome'><font color='#87CEEB'>  Home  </font></a></li>"; }else{ echo"<li><a href='?page=welcome'>  Home  </a></li>"; } if($_GET["page"] === "about"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=about'><font color='#87CEEB'>  About  </font></a></li>"; }else{ echo"<li><a href='?page=about'>  About  </a></li>"; } if($_GET["page"] === "media"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "music"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "images"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "images2"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "albums"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "links"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "widgets"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }else{ echo"<li><a href='?page=media'>  Media  </a></li>"; } if($_GET["page"] === "downloads"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=downloads'><font color='#87CEEB'>  Downloads  </font></a></li>"; }else{ echo"<li><a href='?page=downloads'>  Downloads  </a></li>"; } if($_GET["page"] === "contact"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=contact'><font color='#87CEEB'>  Contact  </font></a></li>"; }else{ echo"<li><a href='?page=contact'>  Contact  </a></li>"; } if($_GET["page"] === "guestbook"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=guestbook'><font color='#87CEEB'>  Guestbook  </a></li>"; }else{ echo"<li><a href='?page=guestbook'>  Guestbook  </a></li>"; } ?><div><p id="quote"><?php require'quote.php' ?></p></div> </ul> </div> </div><?php if (file_exists("" . $_GET["page"] . ".php")) {include("" . $_GET["page"] . ".php");} elseif($_GET["page"] == "") {include("welcome.php");}?> </div></div> <ul id="foot"> <li><a href="?page=welcome">Home</a> |</li> <li><a href="?page=about">About</a> |</li> <li><a href="?page=media">Media</a> |</li> <li><a href="?page=downloads">Downloads</a> |</li> <li><a href="?page=support">Support</a> | </li> <li><font color="#409df9">Copyright © 2009 Attila Hajzer - All Rights Reserved</font></li> </ul></body></html> and when you told me to try your code for my index file this is what i tried: <!DOCTYPE HTML PUBLIC "-//W3C//Dli HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dli"><html><head><title>Attila Hajzer - <?php require_once'title.php' ?></title><meta name="description" content="Webite Designs" /><link rel="stylesheet" type="text/css" href="default.css" /><link rel="stylesheet" type="text/css" href="style.css" /></head><body bgcolor="#F8F8F8"><div id="container"> <div id="top"> <h1 class="heading">A light breeze</font></h1> <div id="date"><?php echo date("l, F j, Y"); ?></div> </div> <div id="background"> <div id="wrapper"> <div id="navigation"> <ul> <?php if($_GET["page"] == ""){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=welcome'><font color='#87CEEB'>  Home  </font></a></li>"; }elseif($_GET["page"] === "welcome"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=welcome'><font color='#87CEEB'>  Home  </font></a></li>"; }else{ echo"<li><a href='?page=welcome'>  Home  </a></li>"; } if($_GET["page"] === "about"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=about'><font color='#87CEEB'>  About  </font></a></li>"; }else{ echo"<li><a href='?page=about'>  About  </a></li>"; } if($_GET["page"] === "media"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "music"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "images"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "images2"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "albums"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "links"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }elseif($_GET["page"] === "widgets"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=media'><font color='#87CEEB'>  Media  </font></a></li>"; }else{ echo"<li><a href='?page=media'>  Media  </a></li>"; } if($_GET["page"] === "downloads"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=downloads'><font color='#87CEEB'>  Downloads  </font></a></li>"; }else{ echo"<li><a href='?page=downloads'>  Downloads  </a></li>"; } if($_GET["page"] === "contact"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=contact'><font color='#87CEEB'>  Contact  </font></a></li>"; }else{ echo"<li><a href='?page=contact'>  Contact  </a></li>"; } if($_GET["page"] === "guestbook"){ echo"<li style='background-image: url(images/nav_hov.jpg);'><a href='?page=guestbook'><font color='#87CEEB'>  Guestbook  </a></li>"; }else{ echo"<li><a href='?page=guestbook'>  Guestbook  </a></li>"; } ?><div><p id="quote"><?php require'quote.php' ?></p></div> </ul> </div> </div><?php// YOUR CODE! if(isset($_GET["page"]) && !empty($_GET["page"]) && is_string($_GET["page"])) if (file_exists("" . $_GET["page"] . ".php")) { header("Location: " . $_GET["page"] . ".php"); } else { header("Location: welcome.php"); } else { header("Location: welcome.php"); }?> </div></div> <ul id="foot"> <li><a href="?page=welcome">Home</a> |</li> <li><a href="?page=about">About</a> |</li> <li><a href="?page=media">Media</a> |</li> <li><a href="?page=downloads">Downloads</a> |</li> <li><a href="?page=support">Support</a> | </li> <li><font color="#409df9">Copyright © 2009 Attila Hajzer - All Rights Reserved</font></li> </ul></body></html> Link to comment Share on other sites More sharing options...
Guest FirefoxRocks Posted July 24, 2009 Report Share Posted July 24, 2009 Ohh I thought that what you gave previously was the entire index page. Please ignore my code above. This is should be the right code then: <?php if(isset($_GET["page"]) && !empty($_GET["page"]) && is_string($_GET["page"])) if (file_exists("" . $_GET["page"] . ".php")) { require_once($_GET["page"] . ".php"); } else { require_once "welcome.php"; } else { require_once "welcome.php"; }?> And please change this line in your HTML code: <!DOCTYPE HTML PUBLIC "-//W3C//Dli HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dli"> To this: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> Link to comment Share on other sites More sharing options...
attila2452 Posted July 24, 2009 Author Report Share Posted July 24, 2009 Ohh I thought that what you gave previously was the entire index page. Please ignore my code above. This is should be the right code then:<?php if(isset($_GET["page"]) && !empty($_GET["page"]) && is_string($_GET["page"])) if (file_exists("" . $_GET["page"] . ".php")) { require_once($_GET["page"] . ".php"); } else { require_once "welcome.php"; } else { require_once "welcome.php"; }?> And please change this line in your HTML code: <!DOCTYPE HTML PUBLIC "-//W3C//Dli HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dli"> To this: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> it works. but . now how do i get that the same in media. like you know how index has a nav and a content place?wel i want that for media aswell i have the nav.include 'media-nav.php'; and then i have content which are the pages that the Media nav navigates to. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now