Forum Moderators: coopster

Message Too Old, No Replies

Conflict with php and includes?

         

Dexie

6:35 pm on Jul 11, 2005 (gmt 0)

10+ Year Member



I've hit a problem - I have includes on a page where I'm trying to put some php code, but when changing the pages extn to .php the includes don't work - is there a conflict?

jatar_k

6:36 pm on Jul 11, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I assume you mean that the includes are SSI?

you can include with php as well.
[php.net...]

encyclo

6:39 pm on Jul 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you are switching from SSI to PHP, you should use PHP includes. If the includes are in the same directory as the page you can use this:

<?php include("file.inc.php");?>

Otherwise you can define the path like this:

<?php include($_SERVER["DOCUMENT_ROOT"]."/path-to/file.inc.php");?>

Dexie

7:37 am on Jul 12, 2005 (gmt 0)

10+ Year Member



Many thanks for the help on this, I've also come across another help page:

One thing, you have the 'main' page, and then you have another page that will be a php include - do *both* have to have the php extn?

[edited by: jatar_k at 4:40 pm (utc) on July 12, 2005]
[edit reason] removed url [/edit]

maxi million

8:39 am on Jul 12, 2005 (gmt 0)

10+ Year Member



no. you can comfortably include .php in .html, provided that the .html is parsed by the php engine. you need to tweak that with .htaccess

Dexie

8:57 am on Jul 12, 2005 (gmt 0)

10+ Year Member



Hi Maxi, many thanks for that.

I must admit, despite the excellent help here and the different websites suggested, I'm having a massive struggle with one page ;-( Would any of you kind souls be able to sticky me, if you could just look at it all please?

Dexie.

Dexie

9:01 am on Jul 12, 2005 (gmt 0)

10+ Year Member



Stop press - whooooaaa, I found that I had to first delete the old index.html file that was on the web.

It now works.

Thanks for all the help.

No doubt I'll be back here again soon ;-)

maxi million

9:39 am on Jul 12, 2005 (gmt 0)

10+ Year Member



:) glad to hear that uve fixed it up!