open inside current page
Moderator: General Moderators
open inside current page
is there a PHP code that allows me to open a page inside a site that uses include tags and then the code for the main page and when you click a link it changes ???
Something like this will do it...
If you click on "News Page" then a file called news.php will be loaded, if you click on "Biog Page" then a file called biog.php will be loaded.
It should work
Code: Select all
<?php
if(!isset($_GET["page"]))
{
$page = "news";
}
else
{
$page = $_GET["page"];
}
?>
<html>
<head>
</head>
<body>
<?php include($page.".php") ?>
<hr />
<a href="?page=news">News Page</a><br />
<a href="?page=biog">Biog Page</a>
</body>
</html>It should work
Code: Select all
else
{
$page = $_GET["page"];
}Code: Select all
else
{
$page = basename($_GET["page"]);
}