Embedding with Serendipity

Discussion corner for Developers of Serendipity.
Post Reply
MCXSC
Posts: 4
Joined: Tue Dec 22, 2009 10:18 pm
Location: Germany

Embedding with Serendipity

Post by MCXSC »

Hi there,

I've installed Serendipity on my webserver and wants an embedding "version". I've read the documenatation "Embedding with Serendipity":

Code: Select all

<?php
  chdir("<serendipity_dir>");
  require("index.php");
  chdir("<original_dir>");
?>
To "include" the index.php file - no problem. But how I could include f.e. one entry? The basiclink is f.e.: http://www.url.com/serendipity/archives/1-dsgdgs.html.

Any idea? :(

Thx,
MCXSC
Sorry, for my bad english grammar... :D
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Embedding with Serendipity

Post by garvinhicking »

Hi!

You might want to get yourself familiar with the serendipity API, i.e. all functions contained (and documented) inside the functions_entries.inc.php file.

And check this:
http://www.s9y.org/78.html#A7

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/
MCXSC
Posts: 4
Joined: Tue Dec 22, 2009 10:18 pm
Location: Germany

Re: Embedding with Serendipity

Post by MCXSC »

Ok, let me explain:

My website (php based) is on the root dir. "index.php" ist my indexpage. I've a file named "wrapper.php":
<?php
ob_start();
chdir("serendipity/");
require("index.php");
chdir("../");
$blog = ob_get_contents();
ob_end_clean();
?>
If I click on "Blog" (a image in my navigation), the link is "index.php?q=blog". It includes f.e. a file or anything. This file is:

Code: Select all

<?php
echo $blog;
?>
This "writes" the blogcontent completely in the html of "index.php?q=blog". Problem: The Links are f.e. not "index.php?q=blog&blabla", they are "serendipity/archieves/...", so they don't be included.

I now tried some of this post: I set "../index.php?q=blog" as Blog-Index in the adminpanel and did some changes in the .htacess: I replaced things like "index.php?q=blog?url=..." with "index.php?q=blog&url=...". And, lets see: The links in the wrapper-output are working.

But: The formaction for comments f.e. are still "index.php?q=blog?...", also the formaction of the searchbox... That's the only problem I (just) have... :(

Any idea? I think it could be just a global-variable?
Sorry, for my bad english grammar... :D
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Embedding with Serendipity

Post by garvinhicking »

Hi!

Ah! What you need to do is set the "Embed index file" from "index.php" to your "wrapper.php" (or a new file, that simply includes your main framework with the $_GET variables all set as if you call your usuall application workflow).

This will then route all s9y page calls through the wrapper.php file, which is the wrapper for your content page.

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/
MCXSC
Posts: 4
Joined: Tue Dec 22, 2009 10:18 pm
Location: Germany

Re: Embedding with Serendipity

Post by MCXSC »

Yes, I know. But my wrapper isn't really the wrapper.php, but "index.php?q=blog"... The included file for "?q=blog" "includes" the wrapper. To set the Indexpage to "wrapper.php" it didn't works...
Sorry, for my bad english grammar... :D
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Embedding with Serendipity

Post by garvinhicking »

Hi!

Yes, I know. You must build a wrapper.php that includes your (not s9y's) index.php, sets q=blog, which then includes the s9y framework (which then includes s9y's index).

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/
MCXSC
Posts: 4
Joined: Tue Dec 22, 2009 10:18 pm
Location: Germany

Re: Embedding with Serendipity

Post by MCXSC »

Oh, yes. Thank you!
Sorry, for my bad english grammar... :D
Post Reply