I got a little issue,
I have a custom error404.html
I only have one other page on my site, index.html
Please note .html extention is enabled to use php
All my pages come from the database, depending on the url.
Here is what I have,
Code: Select all
<?php session_start();
include_once($_SERVER['DOCUMENT_ROOT'].'/includes/connection.html');
$domain_name = $_SERVER['HTTP_HOST'];
$page_name = str_replace('/', '', $_SERVER['SCRIPT_NAME']);
$getPage = mysql_query("SELECT
id,
company_name,
company_email,
domain_name,
page_name,
page_details,
page_template,
create_date,
modify_date FROM website_pages WHERE domain_name = '$domain_name' AND page_name = '$page_name' LIMIT 1")or die(mysql_error());
if(mysql_affected_rows() == 0){
$page_template = $_SERVER['DOCUMENT_ROOT'].'/css/standard/';
include_once($_SERVER['DOCUMENT_ROOT'].'/includes/404.html');
exit();
};
echo '<!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" />
';
while($pageRecieved = mysql_fetch_array($getPage)){
extract($pageRecieved);
}
$page_title = substr($page_details,0,30);
$page_keywords = substr($page_details,0,600);
$page_description = substr($page_details,0,100);
echo '<base href="http://'.$_SERVER['HTTP_HOST'].'/" />
<link href="css/'.$page_template.'.css" rel="stylesheet" type="text/css" />
<title>'.$page_title.'</title>
<meta http-equiv="imagetoolbar" content="no" />
<meta name="keywords" content="'.$page_keywords.'" />
<meta name="description" content="'.$page_description.'" />
<meta name="copyright" content="'.$company_name.'" />
<meta name="owner" content="'.$company_email.'" />
<meta name="language" content="en-gb" />
<meta name="rating" content="general" />
<meta name="robots" content="index,follow" />
<meta name="revisit-after" content="7 days" />
<meta name="author" content="ian@domain" />
<meta name="expires" content="never" />
</head>
<body>
<div id="logo"><img src="company_logos/'.$company_name.'" alt="'.$company_name.'" /></div>
<div id="content">'.$page_details.'</div>
<div id="navigation">
<img src="images_'.$page_template.'/navigation_top.jpg" alt="Website Navigation" width="200" height="42" />
';
include_once($_SERVER['DOCUMENT_ROOT'].'/includes/navigation.php');
echo '
</div>
</body>
</html>';
?>
here is my navigation file.
Code: Select all
<?php
$getNavigation = mysql_query("SELECT
domain_name,
page_name FROM website_pages WHERE domain_name = '$domain_name'")or die(mysql_error());
while($navigationRecieved = mysql_fetch_array($getNavigation)){
extract($navigationRecieved);
$page_name = str_replace('.php', '', $page_name);
if($page_name == 'index'){
$page_name = 'Home';
}
echo '<p><a href="'.$page_name = strtolower(str_replace(' ', '-', $page_name)).'.php">'.$page_name.'</a></p>
';
}
?>
home.php
contact us.php
This is why I would like my custom error404.html page to retrieve the requested filename.
for example,
http://www.domain.com/get-me-this-page.html
but god knows how to do it.
I am hoping one of you guys can help me achieve this,
All I am recieving at the moment is, /index.html when the error404.html is included.
I really need to recieve the /what-ever-page.html so that I can query the database and get the needed info.
I am not interested in mod_rewrite or anything like that so suggestions for that are out of the window
My main objective is to build a website using 3 pages.
index.html
connection.html
error404.html
Thanks guys