Jump to content

Recommended Posts

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

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>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.