Sun Aug 15, 2004 1:24 am
Sun Aug 15, 2004 3:56 am
Top of page/navigation
<div>
<? include "page_to_be_displayed.html(or .php)"; ?>
</div>
Bottom stuff like copyright etc.
<?
session_start();
include "db.php";
function content()
{
switch( $_GET['id'] ) {
case '1' :
include 'general.php';
break;
default:
include 'index.php';
break;
}
}
/*function buy()
{
switch( $_GET['action'] ) {
case 'buy' :
include 'buy.php';
break;
default:
include 'index.php';
break;
}
}
*/
?>
<html>
<head>
<title>.:`~Infinite Opportunities~`:.</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="100%">
<tr>
<td>
<img src="../images/banner.gif">
<br />
</td>
</tr>
<tr>
<td>
<table width="65%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<TABLE WIDTH=173 BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR>
<TD>
<IMG SRC="../images/link_01.gif" WIDTH=173 HEIGHT=22 ALT=""></TD>
</TR>
<TR>
<TD background="../images/link_02.gif" width="173" height="20" style="background-repeat: repeat-y;">
<div width=170 style="position: relative; left: 3;">
<?
include "../links.php";
?>
</div>
<!--<IMG SRC="../images/link_02.gif" WIDTH=173 HEIGHT=20 ALT="">--></TD>
</TR>
<TR>
<TD>
<IMG SRC="../images/link_03.gif" WIDTH=173 HEIGHT=10 ALT=""></TD>
</TR>
</TABLE>
</td>
<td valign="top">
<TABLE WIDTH=570 BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR>
<TD>
<IMG SRC="../images/content_01.gif" WIDTH=570 HEIGHT=30 ALT=""></TD>
</TR>
<TR>
<TD background="../images/content_02.gif" WIDTH=570 HEIGHT=52 style="background-repeat: repeat-y;">
<div width=567 style="position: relative; left: 3;">
<?
content();
//buy();
?>
</div>
<!--<IMG SRC="../images/content_02.gif" WIDTH=570 HEIGHT=52 ALT="">--></TD>
</TR>
<TR>
<TD>
<IMG SRC="../images/content_03.gif" WIDTH=570 HEIGHT=30 ALT=""></TD>
</TR>
</TABLE>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Sun Aug 15, 2004 10:05 am
Sun Aug 15, 2004 2:39 pm
<?php
$defPage = "Put Default Page Here"; // default page if others arent valid
$ext = ".php"; // your default extention, such as .html or . php
$page = isset($HTTP_GET_VARS['page']) ? $HTTP_GET_VARS['page'] : (isset($HTTP_POST_VARS['page']) ? $HTTP_POST_VARS['page'] : $defPage);
if(file_exists($page . $ext))
{
include($page . $ext);
}
else
{
include($defPage . $ext);
}
unset($page, $defPage, $ext);
?>
Sun Aug 15, 2004 7:41 pm
Thu Aug 19, 2004 2:12 am
unclekyky wrote:since we're on the topic (kinda ) of not all hosts doing the same thing i thought i would say that $_GET['whatever'] might not work. Do what stoodder did and use $HTTP_GET_VARS['whatever']. The main reason i don't do what stoodder did (the pagename in the url "www.blah.com?page=mypage1") is because then the user can try going to mypage1.php/html/htm/etc and the layout would be messed up. Then you would have to do some other coding to prevent that...
Thu Aug 19, 2004 5:20 am
kwo_dude wrote:i don't want to use iframes, is there still a way to display content from a different page on the main page? i can use php scripts if neccessary.
Thu Aug 19, 2004 2:56 pm
Code:
<?php
$defPage = "Put Default Page Here"; // default page if others arent valid
$ext = ".php"; // your default extention, such as .html or . php
$page = isset($HTTP_GET_VARS['page']) ? $HTTP_GET_VARS['page'] : (isset($HTTP_POST_VARS['page']) ? $HTTP_POST_VARS['page'] : $defPage);
$page = htmlspecialchars($page);
$page =strtolower($page);
if($page == "index")
{
$page = $defpage;
}
if(file_exists($page . $ext) && !preg_match("/:\/\//", $page))
{
include($page . $ext);
}
else
{
include($defPage . $ext);
}
unset($page, $defPage, $ext);
?>