Embedding Serendipity, how?

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Davy
Regular
Posts: 109
Joined: Fri Oct 13, 2006 2:06 pm
Location: The Netherlands

Embedding Serendipity, how?

Post 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?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Embedding Serendipity, how?

Post 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
# 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/
Davy
Regular
Posts: 109
Joined: Fri Oct 13, 2006 2:06 pm
Location: The Netherlands

Re: Embedding Serendipity, how?

Post 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...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Embedding Serendipity, how?

Post by garvinhicking »

Hi!

See here:

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

Best regards,
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/
Davy
Regular
Posts: 109
Joined: Fri Oct 13, 2006 2:06 pm
Location: The Netherlands

Re: Embedding Serendipity, how?

Post by Davy »

Okay, so if I use those ob_start() and such functions, S9Y can handle links properly?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Embedding Serendipity, how?

Post 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
# 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/
Davy
Regular
Posts: 109
Joined: Fri Oct 13, 2006 2:06 pm
Location: The Netherlands

Re: Embedding Serendipity, how?

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Embedding Serendipity, how?

Post 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
# 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/
Davy
Regular
Posts: 109
Joined: Fri Oct 13, 2006 2:06 pm
Location: The Netherlands

Re: Embedding Serendipity, how?

Post by Davy »

Well, maybe we'll just put S9Y in a frame, that will always work even though it's not really beautiful webprogramming.
Davy
Regular
Posts: 109
Joined: Fri Oct 13, 2006 2:06 pm
Location: The Netherlands

Re: Embedding Serendipity, how?

Post 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?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Embedding Serendipity, how?

Post by garvinhicking »

Hi!

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

Best regards,
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/
Davy
Regular
Posts: 109
Joined: Fri Oct 13, 2006 2:06 pm
Location: The Netherlands

Re: Embedding Serendipity, how?

Post 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. :)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Embedding Serendipity, how?

Post 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
# 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/
Davy
Regular
Posts: 109
Joined: Fri Oct 13, 2006 2:06 pm
Location: The Netherlands

Re: Embedding Serendipity, how?

Post 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.
Post Reply