Trying To Include PHP Into Another Page

Roo's picture

She has: 840 posts

Joined: Apr 1999

I'm found this great little script that is great if you want a quicky little image gallery here. It nice, the only bad thing about it is that you have to use HTML4 or else it won't validate.

I put up a test page here

I'm using a header and footer wrapped around the index.php file in that test page.

I'm trying to include the index.php file on my weblog using this:

<?php
include("http://www.sapphirestudios.net/testgallery/index.php");
?>

It's not working! Nothing shows on my weblog!

Is it something with that script itself, or is something wrong with the way that I'm trying to call it in?

(I can't use SSI because the weblog is php..hence I cannot use a shtml extention)

Roo

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

I don't see anything wrong with the page, it shows up for me.

Roo's picture

She has: 840 posts

Joined: Apr 1999

Yes, that's the test page. That part is fine.

I want to include that gallery...index.php file in a weblog post, and it won't show.

demonhale's picture

He has: 3,278 posts

Joined: May 2005

your using a path, try using just the folder and or filename... (assuming you saved the file you inserted the php in also to php).. I guess you found it just now, I was posting about this in refresh your eyes thread, im using that since before...

Roo's picture

She has: 840 posts

Joined: Apr 1999

It was my understanding that you had to include the full path. Yes? No?

demonhale's picture

He has: 3,278 posts

Joined: May 2005

If you insert it into an html file then the embedding is different, in a php file then its just the include tag, for both dont use paths with http, use only folder full paths to make it work, try it out, if you use full paths like the ones you have it will be read just like an html file thus disabling the php commands...

Roo's picture

She has: 840 posts

Joined: Apr 1999

Never mind. I asked on the pmachine forums, and you can't put a php tag into a post.

demonhale's picture

He has: 3,278 posts

Joined: May 2005

if a post supports html you can, theres a hack for this...

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.