Forum Moderators: coopster

Message Too Old, No Replies

PHP not working on website

         

Dragonboi85

5:51 am on Aug 10, 2008 (gmt 0)

10+ Year Member



Is there anyone here that could help me? There is no reason I can find that my include script shouldn't be working but, nevertheless, it's not...

Here's a link to the page:

<snip>

My include code is in the content.php file and here it is:

<?php
$found = FALSE;
if(file_exists("$page.html"))
{
include("$page.html");
$found = true;
}
if(!$found)
{
include("error.html");
}
?>

And yes, that is the corrent directory structure for where the events.html file is located.

[edited by: dreamcatcher at 7:06 am (utc) on Aug. 10, 2008]
[edit reason] No personal urls, thanks. [/edit]

Marcia

6:59 am on Aug 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you put an entry in .htaccess telling the server to parse .html pages for php?

StoutFiles

7:03 am on Aug 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Remove the link to your site or it will be removed by the mods.

$page.html? Do you mean page.html?

Dragonboi85

7:05 am on Aug 10, 2008 (gmt 0)

10+ Year Member



There is no .htaccess file unless the host is hiding if from view.

Dragonboi85

7:08 am on Aug 10, 2008 (gmt 0)

10+ Year Member



I'm a newbie to php, but as far as i now $page is the variable to include my other pages when i link them.

For example:
...?page=dir/dir/file

Dragonboi85

7:16 am on Aug 10, 2008 (gmt 0)

10+ Year Member



I've also contacted my host and they said it's not on their end. I beg to differ because I've used the code numerous times and have had no problems til now. Even used it on the same host and on the same website... it just stopped working one day.

Marcia

7:40 am on Aug 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>just stopped working one day

I've had that happen several times when PHP or Apache was updated by hosts. I had to change what I had in .htaccess for the file handlers.

In that regard, it isn't automatic that there's an .htaccess file, any more than it's automatic that there be a robots.txt If there's no .htaccess file, open up Notepad and make one yourself, then upload it to the root of your site.

Here you go:

parse html for php [google.com]

>>I'm a newbie to php, but as far as i now $page is the variable to include my other pages when i link them.

But you don't use the variable in an include, you include a file by name (unless you've already assigned a filename to the variable. This is how it's done, it works on every site I do, with .html pages :

<?php include('page.php'); ?>

Actually, when using includes it's better to have a .php file extension, page.php or page.inc.php

[edited by: Marcia at 7:57 am (utc) on Aug. 10, 2008]

Dragonboi85

8:02 am on Aug 10, 2008 (gmt 0)

10+ Year Member



Thanks! It was the .htaccess file... and the support guys at my host didn't even have a clue! Thank you everyone for your help!