Page 1 of 1

Emdedding troubles

Posted: Tue Nov 06, 2007 6:34 pm
by Racketman
So, I need embed Serendipity into "something else". I have the s9y in [http://www.mysite.com/blog], activated embed mode, imported the blog to [http://www.mysite.com/blog/index.php] and got it to work...sort of.

The problem is that the links to comment things or static pages or whatever relative stuff still point to [http://www.mysite.com/blog/index.php], so it's a bit of a problem. I could do a dirty str_replace (from [http://www.mysite.com/blog/index.php] to [http://www.mysite.com/index.php]) for the blog links, but that opens a whole new can of worms to be patched, and I couldn't really find an easy way to do it.

The guides are sort of unclear on this, so...how would I get the relative links to properly? Especially with stuff like static pages or so? There must be something I'm missing here.

Also, please be as clear and concise as possible, since I tried finding this out from the embedding guide here to no avail.

Re: Emdedding troubles

Posted: Tue Nov 06, 2007 10:52 pm
by garvinhicking
Hi!

Did you check the s9y indexFile option? You can set that to your own wrapper.php file, which can include your original content of the blog.

If you need to show the contents of s9y in a different path than it is installed into, you will need to configure the s9y instance to use the path that you later want to use, so that permalinks and relative links are properly stored. You might need custom mod_rewrite links to redirect any actual files to the subdirectory (like files in /upload/), and also calls to files like comment.php.

If that doesn't help, you'll need to be more precise and show us what your actual URL looks like, and what exactly you want to achieve. Embedding is a complex can of worms, with any application. :)

HTH,
Garvin

Right.

Posted: Tue Nov 06, 2007 11:44 pm
by Racketman
This is a simplified version of the layout I was supposed to be having, since I want to get rid of everything that might've caused problems.

So, the URL http://www.fraeon.info and the place where Serendipity is is http://fraeon.info/blog

Now, again, it works for the most part by changing the indexFile option. The problem I keep having is with the Static Pages plugin. Clicking "stuff" in the page should bring up a static page I've done, but it doesn't do anything but show the list of blog entries. Basically the current front page, that is.

Any ideas how to fix this particular problem? Otherwise it seems I'm set.

EDIT: The default permalink for the static page is index.php?/pages/stuff.html if that helps
EDIT2: Hmh, the archives don't work either. Same problem as the static pages.

Re: Right.

Posted: Wed Nov 07, 2007 11:11 am
by garvinhicking
Hi!

It might be the problem that the permalink lookups from s9y fail, because your $_SERVER['REQUEST_URI'] is set to "/" instead of "/blog/". Can you try to make your wrapper file set the $_SERVER['REQUEST_URI'] to include the '/blog/' part? Then serendipity should be able to lookup the right permalink.

Regards,
Garvin

Posted: Wed Nov 07, 2007 1:13 pm
by Racketman
Um, example, please? I'm sort of lost with your explanation. Where should I put change that variable?

Do you mean I should try having the links go to [http://fraeon.info/index.php?/blog/pages/stuff.html] instead of [http://fraeon.info/index.php?/pages/stuff.html]?

Or what was it you meant?

Sorry for sounding stupid here. :?

Posted: Wed Nov 07, 2007 2:24 pm
by garvinhicking
Hi!

Ah, sorry, I forgot. I was carried away. :)

How does your wrapper fille (fraeon.info/index.php) currently look like? It would be modified like this:

Code: Select all

$_SERVER['REQUEST_URI'] = '/blog' . $_SERVER['REQUEST_URI'];
// .. here comes the rest and s9y inclusion
HTH,
Garvin

Posted: Wed Nov 07, 2007 10:44 pm
by Racketman
The index file actually calls a wrapper.php file that looks like this:

Code: Select all

		
<?php
   ob_start();
   chdir("blog/");
   require("index.php");
   chdir("../");
   $serendipity_content = ob_get_contents();
   ob_end_clean(); 
   echo $serendipity_content 
?>
Straight out of the embedding guide.

Posted: Thu Nov 08, 2007 11:00 am
by garvinhicking
Hi!

Okay, you can modify that file with the extra line that I posted, put it at before the first ob_start().

Regards,
Garvin