mysterious include problem
| From: | Allen McCabe | Date: | Mon, 07 Dec 2009 20:03:52 +0000 |
| Subject: | mysterious include problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-300286@lists.php.net to get a copy of this message | ||
I have been using includes for my content for a while now with no problems.
Suddenly it has stopped working, and it may or may not be from some changes
I made in my code structure.
I use default.php for most or all of my pages within a given directory,
changing the content via page numbers in the query string.
So on default.php, I have the following code:
<?php
if(isset($_GET['page']))
{
$thispage = $_GET['page'];
$content = 'content/'.$_GET['page'].'.inc';
}
else
{
$thispage = "default";
$content = 'content/default.inc';
}
?>
<html>, <body>, <div> etc.
<?php include($content); ?>
I have a content subdirectory where I store all the pages with files such as
"default.inc, 101.inc, 102.inc, etc.
As I said, this has been working fine up until now, if I use the url
"user/default.php" or just "user/" I get this error:
*Warning*: include(content/.inc)
[function.include<http://lpacmarketing.hostzi.com/user/function.include>]:
failed to open stream: No such file or directory in *
/home/a9066165/public_html/user/default.php* on line *89*
AND
*Warning*: include()
[function.include<http://lpacmarketing.hostzi.com/user/function.include>]:
Failed opening 'content/.inc' for inclusion
(include_path='.:/usr/lib/php:/usr/local/lib/php') in *
/home/a9066165/public_html/user/default.php* on line *89*
But if I use "user/default.php?page=default" I get the correct content.
It's acting as if page is set, but set to NULL, and then trying to find an
include at path "content/.inc" what's going on??