You are invited to Log in or Register a free Frihost Account!

php includes

hi guys I'm just starting out with php and didn't want to do anything complicated, just use incluse so it's easier to change my site's sidebar etc. I've inserted the following code into my homepage but the two includes, well aren't being included. Maybe this is just a silly mistake or assumption by me, if so feel free to set me straight.

<? php require("navtaobhbar.htm"); ?>
<? php require("banner.htm"); ?>

thanks for your help!
Maybe try <?php ... ?>, without the space between the question mark and the php. Otherwise you can use include(""), but I don't really know the difference between the two of them.
it's still not working, I think it's got to be something to do with the php, either its wrong or the server just isn't bothering to execute it for some reason. The current attempt is:

<!-- php ag tosú -->
<?php include(""); ?>
<?php include("banner.htm"); ?>
<!-- php críochnaithe -->

Is there anyreason for the server not to execute php? Are the comment tags interfering? Please help me!

You might try to rename the index.htm to index.php. Very Happy

Every file with php inside it should have the .php extension. Or you can handle it with .htaccess, but that's a bit more difficult.
does it need any sort of new php document declarations or can i leave it as i had it as a html document?
davmcmul wrote:
does it need any sort of new php document declarations or can i leave it as i had it as a html document?

The extension .php just tells the server to treat the document as a php file. All <? ?> will be replace by somthing else. You don't have to change anything.

Just see it like a txt file that you rename to a .html file. If you open the .txt file, you'll only get text. When you open the .hml file, the browser will change the tags to graphics and you'll get a webpage. The difference with php is that the server executes and renders the code.
great! thanks a lot!
Related topics
Hacker-proof site without php?
How to create a dynamic PHP website.
Do we support php include and/or SSI?
Server Load
You're invited!!!!
Putting something on every page...
HTML help needed
Shouldn´t I use frames?
PHP Includes and Variables?
Hoe mijn site volledig zichtbaar maken via google
Website layout
form mail problems (quality help=frih$)
PHP mailing script
PHP Includes Problem
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

© 2005-2011 Frihost, forums powered by phpBB.