Page 1 of 1

Can't get embedding with subdirectory working.

Posted: Sun May 23, 2004 8:04 pm
by The CrazyEngineer
As a preface, I've read all the other posts I could find on this problem, as well as the site documentation and the README file in the distribution and still can't get this working. If there is somewhere else I should be looking, please post a link.

I'm trying to embed s9y in my own content pages.

I've installed serendipity to a subdirectory of my doc root.

I renamed the normal index.php in the distribution to blog.php. I made a new test index.php and put it in the /serendipity subdirectory.

<?php
ob_start();
require 'blog.php';
$blog_data = ob_get_contents();
ob_end_clean();

echo $blog_data;
?>

This works fine. (The indexFile in the paths in the configuration is index.php and all the paths for the installation point to the subdirectory).

However, when I move the index.php file to my doc root and change the require line to require 'serendipity/blog.php'

I get 'Serendipity is not yet installed. Please install it now.'

Doing some quick debugging it looks like the line

define('IS_installed', file_exists((isset($serendipity['serendipityPath']) ? $serendipity['serendipityPath'] : '') . 'serendipity_config_local.inc.php'));

in serendipity_config.inc.php isn't setting IS_installed to true

What am I missing?

Also, someone else had mentioned they got this setup working but had trouble with comments working. Is that going to be a problem with this setup?

Thanks

Re: Can't get embedding with subdirectory working.

Posted: Sun May 23, 2004 11:41 pm
by garvinhicking
However, when I move the index.php file to my doc root and change the require line to require 'serendipity/blog.php'
Yes. Use '"chdir("serendipity")" in your index.php replacement file. And after the require, do a chdir to your docroot again. That should do the trick.
Also, someone else had mentioned they got this setup working but had trouble with comments working. Is that going to be a problem with this setup?
I only developed the embed-option by having the wrap-file inside of the same directory structure as s9y, so I have no experience with placing the wrapfile inside of a different directory. Theroetically it should work, but yes - it could cause specific problems.

Regards,
Garvin.

Posted: Mon May 24, 2004 8:21 am
by Ricardo
I do it this way around

wrapper.php (in serendipity directory)

Code: Select all

<?php
$_REQUEST['page'] = 'blog';
// Let serendipity generate our content:
ob_start();
require 'index.php';
$blog_data = ob_get_contents();
ob_end_clean();

// Now we include our normal content building file.
// This one has to make use of your $blog_data variable to print
// the content where appropriate!
require '../index.php';
?>
index.php (in root directory)

Code: Select all

<html>
<head>
<!-- Common META tags and links go here -->
<?php
  if ($_REQUEST['page'] == 'blog') {
    /* Output some blog related META tags and links */
  }
?>
</head>
<body>
<?php
  if ($_REQUEST['page'] != 'blog') {
    /* Output my main site */
  } else {
    /* Blog layout code with 'echo $blog_data' included */
    /* somewhere appropriate */
  }
?>
</body>
</html>
There is probably an easier way of doing it but it is working for me on my test server. Whether or not it will work on the live server is another issue. Will have to see when I get around to uploading it.