blacksaibot Posted March 12, 2011 Share Posted March 12, 2011 Code for index.php: <html> <head> <title>Outer World Investigation Agency</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <center> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td> <ul id="menu"> <li><a href="index.html" class="home"></a></li> <li><a href="mkvsdc.html" class="mkvsdc"></a></li> <li><a href="mk2011.html" class="mk2011"></a></li> <li><a href="mkr.html" class="mkr"></a></li> </ul> </td> </tr> </table> <div id="div-name"> <?php include("mainpage.html"); ?> </div> </center> </body> </html> How can I make the links within the included HTML file (mainpage.html) open its contents within itself as if it were a separate frame from my index.php file? Whenever I click a link that's in mainpage.html it opens the link and my PHP file is gone. My PHP file includes a menu that I don't want to have to re-write over and over again in each HTML page. Quote Link to comment Share on other sites More sharing options...
flolam Posted March 12, 2011 Share Posted March 12, 2011 you could make your links point to <a href="/index.php?site=index"></a> <a href="/index.php?site=mkvsdc"></a> ... etc. and then change the include to <?php if (!$_GET["site"]) { //in the case that no site was specified, include index.html include "index.html"; } else { include $_GET["site"].".html"; } ?> Also, include should be used without brackets Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.