Problems Embdedding Serendipity Into HTML
Problems Embdedding Serendipity Into HTML
Hi All,
I've been trying to bring the content into a test page but keep failing at the first hurdle.
I've just reinstalled it all and this is my latest error:
Fatal error: main() [function.require]: Failed opening required 'index.php' (include_path='.;c:\php4\pear') in C:\Domains\peoplepassionplanet.com\wwwroot\wrapper.php on line 4
I can access the blog here: http://www.peoplepassionplanet.com/blog/ and it seems to work fine, any ideas why I can't get it to embed would be greatly appreciated.
I've been trying to bring the content into a test page but keep failing at the first hurdle.
I've just reinstalled it all and this is my latest error:
Fatal error: main() [function.require]: Failed opening required 'index.php' (include_path='.;c:\php4\pear') in C:\Domains\peoplepassionplanet.com\wwwroot\wrapper.php on line 4
I can access the blog here: http://www.peoplepassionplanet.com/blog/ and it seems to work fine, any ideas why I can't get it to embed would be greatly appreciated.
by the way my test page is http://www.peoplepassionplanet.com/test.php 
The problem would appear to be that the Serendipity index.php isn't in /blog/. I'd try it without the first / and see what happens.
You might also want to see if your chdir is actually working:
You might also want to see if your chdir is actually working:
Code: Select all
<?php
if (chdir("blog/"))
{
ob_start();
require("index.php");
chdir("../");
$serendipity_contents = ob_get_contents();
ob_end_clean();
}
else
{
$serendipity_contents = "Couldn't change directory!\n";
}
?>
Thanks Judebert,
If I do this:
I get a page cannot be displayed.
And if I do this:
It gives me
"Your non-Serendipity content goes here. Couldn't change directory! More non-Serendipity content here."
So you were right - it can't change directory, any idea why?
I tried changing permissions on the blog directory, but this didn't seem to work
If I do this:
Code: Select all
<?php
if (chdir("blog/"))
{
ob_start();
require("index.php");
chdir("../");
$serendipity_contents = ob_get_contents();
ob_end_clean();
}
else
{
$serendipity_contents = "Couldn't change directory!\n";
}
?> And if I do this:
Code: Select all
<?php
if (chdir("/blog/"))
{
ob_start();
require("index.php");
chdir("../");
$serendipity_contents = ob_get_contents();
ob_end_clean();
}
else
{
$serendipity_contents = "Couldn't change directory!\n";
}
?> "Your non-Serendipity content goes here. Couldn't change directory! More non-Serendipity content here."
So you were right - it can't change directory, any idea why?
I tried changing permissions on the blog directory, but this didn't seem to work
I have found that if I put wrapper.php and test.php into the blog/ directory and then use
then test.php takes me to the serendipity_admin.php page! AAh so close yet so far! 
Code: Select all
<?php
ob_start();
chdir("/");
require("index.php");
chdir("/");
$serendipity_contents = ob_get_contents();
ob_end_clean();
?>having tried just about every combination of how to change directories I can think of, if I put the full path to everything in so my wrapper.php looks like this:
and my test.php looks like this:
It does then display the html - but not the serendipity contents.
back to more head scratching
Code: Select all
<?php
ob_start();
chdir("http://www.peoplepassionplanet.com/blog/");
require("index.php");
chdir("http://www.peoplepassionplanet.com/");
$serendipity_contents = ob_get_contents();
ob_end_clean();
?>Code: Select all
<?php
require("http://www.peoplepassionplanet.com/blog/wrapper.php"); // stores S9Y in a variable
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
Your non-Serendipity content goes here.
<?php
echo $serendipity_contents; // Print the variable
?>
More non-Serendipity content here.
</body>
</html> back to more head scratching
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
You cannot chdir() to a HTTP path location! You need to use proper relative or absolute paths. What you do now works via HTTP inclusion, which does not do what you want.
What judebert said was right, you need to check what the absolute path of your /blog directory is and use chdir with that one.
HTH,
Garvin
You cannot chdir() to a HTTP path location! You need to use proper relative or absolute paths. What you do now works via HTTP inclusion, which does not do what you want.
What judebert said was right, you need to check what the absolute path of your /blog directory is and use chdir with that one.
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
ah ok 
is there any way to know what this path is without just trying different combinations of guessed paths?
the index.php and wrapper .php are in
wwwroot/blog/
and my test.php page is in
wwwroot
so i've tried
chdir("/blog/");
and
chdir("../");
and
chdir("blog/");
and
chdir("/");
and
chdir("blog/");
and
chdir(".");
and combinations of those but as yet can't get it!!
is there any way to know what this path is without just trying different combinations of guessed paths?
the index.php and wrapper .php are in
wwwroot/blog/
and my test.php page is in
wwwroot
so i've tried
chdir("/blog/");
and
chdir("../");
and
chdir("blog/");
and
chdir("/");
and
chdir("blog/");
and
chdir(".");
and combinations of those but as yet can't get it!!
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Try to put
<?php die(dirname(__FILE__)); ?>
into the index.php file or wrapper.php file to see theoutput of the full path where the script currently resides in!
HTH,
Garvin
Try to put
<?php die(dirname(__FILE__)); ?>
into the index.php file or wrapper.php file to see theoutput of the full path where the script currently resides in!
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Actually you will need to use
HTH,
Garvin
Actually you will need to use
Code: Select all
chdir('/Domains/peoplepassionplanet.com/wwwroot/blog');
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
You can only get this error message if you used
instead of what I wrote:
...?
You can only get this error message if you used
Code: Select all
chdir('Domains/peoplepassionplanet.com/wwwroot/blog');
Code: Select all
chdir('/Domains/peoplepassionplanet.com/wwwroot/blog');
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Yes - you're right. So if I have this in wrapper.php
<?php
ob_start();
chdir("/Domains/peoplepassionplanet.com/wwwroot/blog/");
require("index.php");
chdir("/Domains/peoplepassionplanet.com/wwwroot/");
$serendipity_contents = ob_get_contents();
ob_end_clean();
?>
and this in the top of test.php
<?php
require("blog/wrapper.php");
?>
I get a page cannot be displayed. Can you correct what I'm doing wrong? (I have tried a few other combinations)
<?php
ob_start();
chdir("/Domains/peoplepassionplanet.com/wwwroot/blog/");
require("index.php");
chdir("/Domains/peoplepassionplanet.com/wwwroot/");
$serendipity_contents = ob_get_contents();
ob_end_clean();
?>
and this in the top of test.php
<?php
require("blog/wrapper.php");
?>
I get a page cannot be displayed. Can you correct what I'm doing wrong? (I have tried a few other combinations)