Excali Posted March 24, 2008 Share Posted March 24, 2008 Hi, I made an index.php page which look like this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="Maindiv"> <div id="Hoofdingdiv"> <div id="Hoofding_contentdiv">Chun is conquering the banners .</div> </div> <div id="Menudiv"> <div id="Menu_contentdiv"> <?php include("navigatie.php");?> </div> </div> <div id="Middendiv"> <div id="Midden_leftmenudiv"><?php include("left_content.php"); ?></div> <div id="Midden_contentdiv"><?php include("main.php"); ?></div> <div id="Midden_rightmenudiv"><?php include("right_content.php"); ?></div> </div> <div id="Onderdiv"></div> </div> </body> </html> but in my navigatie.php I've only used this code: <table id="Menu_contentdiv"> <tr> <td><a href="pages/index.php">main</a></td> <td><a href="pages/encyclopaedia.php">encyclopaedia</a></td> <td><a href="pages/restaurants.php">restaurants</td> <td><a href="pages/search.php">search</td> <td><a href="pages/information.php">information</td> </tr> </table> Now my question is, how I should work to have only the midden_content changed. I've tried to use Javascript language but that didn't work. I think the include functions are not a good idea in this case, right? here is my website atm: http://ims0708d03.dreamhosters.com/ Link to comment https://forums.phpfreaks.com/topic/97593-need-help-for-replacing-div-content/ Share on other sites More sharing options...
ansarka Posted March 24, 2008 Share Posted March 24, 2008 ONLY ANSWER IS AJAX Link to comment https://forums.phpfreaks.com/topic/97593-need-help-for-replacing-div-content/#findComment-499345 Share on other sites More sharing options...
MadTechie Posted March 24, 2008 Share Posted March 24, 2008 ONLY ANSWER IS AJAX Erm.. No! you can use Javascript / AJAX but you can also use frames or try this nav <table id="Menu_contentdiv"> <tr> <td><a href="?pages=index">main</a></td> <td><a href="?pages=encyclopaedia">encyclopaedia</a></td> <td><a href="?pages=restaurants">restaurants</td> <td><a href="?pages=search">search</td> <td><a href="?pages=information">information</td> </tr> </table> <?php // you could do //include $_GET['pages'].".php"; // but you have loss control switch($_GET['pages']) { case "encyclopaedia": include "encyclopaedia.php"; break; case "restaurants": include "restaurants.php"; break; case "search": include "search.php"; break; case "information": include "information.php"; break; default: include "home.php"; break; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="Maindiv"> <div id="Hoofdingdiv"> <div id="Hoofding_contentdiv">Chun is conquering the banners .</div> </div> <div id="Menudiv"> <div id="Menu_contentdiv"> <?php include("navigatie.php");?> </div> </div> <div id="Middendiv"> <div id="Midden_leftmenudiv"><?php include("left_content.php"); ?></div> <div id="Midden_contentdiv"><?php include("main.php"); ?></div> <div id="Midden_rightmenudiv"><?php include("right_content.php"); ?></div> </div> <div id="Onderdiv"></div> </div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/97593-need-help-for-replacing-div-content/#findComment-499348 Share on other sites More sharing options...
ansarka Posted March 24, 2008 Share Posted March 24, 2008 its a good method i am sorry for giving wrong information Link to comment https://forums.phpfreaks.com/topic/97593-need-help-for-replacing-div-content/#findComment-499351 Share on other sites More sharing options...
MadTechie Posted March 24, 2008 Share Posted March 24, 2008 lol, no need to be sorry your helping either way.. just becareful of using the word "only", theirs all ways another way to skin a cat as a side know i personally think AJAX is over used now days (common problem with buzz words) Link to comment https://forums.phpfreaks.com/topic/97593-need-help-for-replacing-div-content/#findComment-499355 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.