PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I do not understand why the include statements work when I have the file named as test.php but it doesn't work when I have the file named as test.html.
The company which provides the information generated by the two URL's in the include statement state that the statements should work as an .html document.
Yes they work "as" an HTML document in the sense that the output is no different or special compared with plain HTML.
But in order for PHP to run on the server the file must be named with a .php extension.
Your file is simply being read a plain HTML by the server and so the PHP inside it isn't being parsed.
If you really really must use a .html extension then you have to do some things with either .htaccess or httpd.conf but we wont go down that road unless needed
I'm not sure what I'm going to do. One of those include statements needs to be placed on the home page.
When a person types a web address, the browser automatically loads the index.htm/html page. In order for the includes to work, I would need to rename my index page to index.php. The browser won't load the .php page automatically.
Perfect sense... so are you saying that your host offers PHP but won't load index.php by default? That's bad... very bad..
Anyway... you can fix it if your host uses apache by creating a file named ".htaccess" (starts with a dot) in the folder the file will be loaded from. Open it an enter just the following line...
Rename your index.html file to index.php and make sure there are no index.html or index.htm files in the same directory since they will load by default before any PHP will.
Fingers crossed... it will now load your index.php file
Will the search engine spiders crawl a page with a PHP extension? This site is being optimized and I want to make sure that the spiders will crawl the content of the index.php file.
Will the search engine spiders crawl a page with a PHP extension? This site is being optimized and I want to make sure that the spiders will crawl the content of the index.php file.
I thought I would let you know that by renaming my files from index.html to index.php, my browser was able to default to index.php and I got the info as I need it.
Thank you so very much. You were a tremendous help!