php include this file<

liunx

Guest
i have a table with the following div statements in it
<div class = text>
<?php include("news.php"); ?>
</div>

how can i have the include statement change to the file that i tell it to by clicking on a certain link..

for example. my homepage is open and i want the
<?php include("news.php"); ?>
to change to
<?php include("about.php"); ?>use a variable...


<a href=http://www.htmlforums.com/archive/index.php/"?Page=news.php">news
<a href=http://www.htmlforums.com/archive/index.php/"?Page=about.php">about


then

include ($_GET['Page']);Or:


$pagename = "blahblah.html"

...

<php include ($pagename); ?>




(syntax might not be exactly right, but you get the idea)<html>
<head>
<title>Include test</title>
</head>
<body>
<table>
<tr>
<td style="width: 25%; vertical-align: top;">
<?php include "menu.php"; ?>
</td>
<td style="width: 75%; vertical-align: top;">
<?php
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 'main';
}

switch ($page) {
case 'gallery':
include 'gallery.php';
break;
case 'games':
include 'games.php';
break;
default:
include 'main.php';
}

?>
</td>
</tr>
</table>
</body>
</html>


This might get you started. It's just an example I made for one of the members here. It's a bit more secure this way. I hope you can understand it. Used like this:
/index.php?page=gallerythanks guys.hehe rydberg, I recognize that script ;) :DOriginally posted by hockyfan641
hehe rydberg, I recognize that script ;) :D

It's called recycling, Josh ;) :D
 
Back
Top