Page 1 of 1

Embedding Serendipity, how?

Posted: Tue Jun 26, 2007 11:16 am
by Davy
Hi!

Our S9Y-installation has always ran independent, but now we'd like to embed it in another webpage on another server. We actually have one part fixed, but we're kinda stuck in the other side of the story, so any help will be appreciated.

At the new webpage, there is a file like content.php with an argument "page" that redirects to S9Y. An example:
$_GET['id'] == 'page';
require('http://www.mysite.com/$page');

This works great, however, when you click a link on the original S9Y-page, it'll try to open the wrong path. Yet another example:
It does: http://www.thenewsite.com/categories/1-something.html
It should do: http://www.thenewsite.com/categories/co ... thing.html

Notice that those two websites have different domainnames. If I enable the "Automatically detect HTTP-Host" function the domainname is right, but still that content.php file is missing in the path.

What's the easiest/best way to fix this, if there is a way?

Re: Embedding Serendipity, how?

Posted: Tue Jun 26, 2007 11:22 am
by garvinhicking
Hi!

You can use the Option in the s9y configuration to specifiy a wrapper bla.php file in the s9y configuration file. Instead of index.php you point it to your own URL.

There's no way to keep the URLs like you have, you need to set those variables via the PHP script and then include your original script.

Best regards,
Garvin

Re: Embedding Serendipity, how?

Posted: Tue Jun 26, 2007 12:15 pm
by Davy
Okay, thanks! Could you please give me a little code example? I looked at the embed documentation, but I didn't really understand how to use it...

Re: Embedding Serendipity, how?

Posted: Tue Jun 26, 2007 12:28 pm
by garvinhicking
Hi!

See here:

http://www.s9y.org/123.html
http://www.s9y.org/55.html

Best regards,
Garvin

Re: Embedding Serendipity, how?

Posted: Tue Jun 26, 2007 12:41 pm
by Davy
Okay, so if I use those ob_start() and such functions, S9Y can handle links properly?

Re: Embedding Serendipity, how?

Posted: Tue Jun 26, 2007 12:48 pm
by garvinhicking
Hi!

ob_start() is only for capturing. Once you set the embed indexFile command to your custom wrapper, those links will point to that file, and within that file you can use your custom PHP to forward to foreign PHP content.php of yours.

Best regards,
Garvin

Re: Embedding Serendipity, how?

Posted: Tue Jun 26, 2007 1:26 pm
by Davy
Hmmm... It's quite hard to understand, but I'll play around with it and see what I can do. After all, thanks for the quick help so far.

Re: Embedding Serendipity, how?

Posted: Tue Jun 26, 2007 1:42 pm
by garvinhicking
Hi!

Sadly embedding of s9y requires some PHP skills, and I tried to describe it as good as I can in the mentioned documentation, so I'm afraid I know no better to describe it. You could search this forum for "embed", there are some more examples of it. :-)

HTH,
Garvin

Re: Embedding Serendipity, how?

Posted: Tue Jun 26, 2007 1:58 pm
by Davy
Well, maybe we'll just put S9Y in a frame, that will always work even though it's not really beautiful webprogramming.

Re: Embedding Serendipity, how?

Posted: Tue Jun 26, 2007 2:27 pm
by Davy
Something else that is very weird, it'd be great if I could change the value of Smarty's BaseURL variable. That would solve nearly everything, won't it?

Re: Embedding Serendipity, how?

Posted: Tue Jun 26, 2007 3:13 pm
by garvinhicking
Hi!

You can't simply change the baseURL if you don'T change what's lying "underneath" of it...

Best regards,
Garvin

Re: Embedding Serendipity, how?

Posted: Tue Jun 26, 2007 7:23 pm
by Davy
Well, now I noticed something else that I can't understand:
I have my rewrite engine turned off, so I've links like http://www.mydomain.com/index.php?/arch ... 07/06.html.
But when I change my indexFile to the wrapper.php file, that link just returns me to the main page.

Here's my wrapper code, I guess that's fine...
<?php
ob_start();
require 'index.php';
$data = ob_get_contents();
echo $data;
?>

I know I'm demanding much, sorry for that. :)

Re: Embedding Serendipity, how?

Posted: Wed Jun 27, 2007 11:48 am
by garvinhicking
Hi!

What do you mean? Then your url points to:

http://www.mydomain.com/wrapper.php?/ar ... 07/06.html.

right?

Regards,
Garvin

Re: Embedding Serendipity, how?

Posted: Wed Jun 27, 2007 7:23 pm
by Davy
garvinhicking wrote:Hi!

What do you mean? Then your url points to:

http://www.mydomain.com/wrapper.php?/ar ... 07/06.html.

right?

Regards,
Garvin
Right, and that doesn't work quite well for an unknown reason. Tomorrow or so I'll experiment with the BaseURL and the templates and see what I can do.