Page 1 of 1

embedding serendipity in an existing smarty environment

Posted: Wed Feb 07, 2007 11:38 pm
by sorar
Hey to all,

i got an existing webpage with an smarty environment. There i do have an index.php where i am requiring my blogwrapper.php and including all specific templates.

Code: Select all

...
//get blog output
require('blogwrapper.php');
...
    case 'about':
        $FSP->tpl->assign("blog",$serendipity_contents);
        $FSP->tpl->display('header.tpl');
        $FSP->tpl->display('left_navi.tpl');
        $FSP->tpl->display('blog.tpl');
        $FSP->tpl->display('right_navi.tpl');
        //$FSP->tpl->display('about.tpl');
        $FSP->tpl->display('footer.tpl');
    break;
...
now i got my blog.tpl where i included my defined variable $blog like this:

Code: Select all

{$blog}
This works, i see the s9y startpage embedded in my webpage.

the folder structure is like this:

htdocs/index.php
htdocs/manyotherstuff
htdocs/templates/alltempates
htdocs/templates/blog.tpl (my template where i am including the output of serendipity)

htdocs/blog here is my serendipity installation with its own index.php

so here is my htdocs/blogwrapper.php

Code: Select all

<?
ob_start();
$a = getcwd();
chdir($a."/blog");
require("index.php");
chdir($a);
$serendipity_contents = ob_get_contents();
ob_end_clean();
?>
so if iam now opening my page http://mypagebla.com/index.php?action=about

i am seeing all my navigation elements, header, footer and in the middle there is my s9y blog and its showing me some entries with their headings.

if i want to open an entry, the entry is not found, i am just getting a blank page.
i know why. It tries to get the html file from somewhere but it is not finding it. I changed the IndexFile to "index.php" (would mean the blog/index.php) and to "../index.php" (the one for the originating page) and i also tried to get a another blogwrapper.php in the blog/ dir because i thought this could handle the output and pass it back to the ../index.php.

But nothing worked. I think maybe i should include the output of s9y in another way not by getting it directly into my smarty engine? Or did i just typed some paths wrong in my blogwrapper.php?

When i changed my IndexFile to blogwrapper.php it allways tried to call
http://mypagebla.com/blog/blogwrapper.p ... entry,html

but this wasnt found.

Help would be highly appreciated. I love serendipity and got it installed for a customer and for my personal blog and the current installation i am working on is for a filespace provider. s9y is really a great application. BIG UP!

thanks in advance,
greeting from germany
sebastian

Re: embedding serendipity in an existing smarty environment

Posted: Thu Feb 08, 2007 10:55 am
by garvinhicking
Hi!

For s9y to work the "indexFile" option must point to a file inside the same directory. So you can't embed s9y when you're "outside" of the current directory scope because followup page links won't match.

With that URL:

http://mypagebla.com/blog/blogwrapper.p ... entry.html

Is that blogwapper.php in the 'blog' subdirectory?

I'm a bit on the hurry right now, so I hope my blabla does give you any input. Did you read the embedding documentation stuff on s9y.org and in the 'expert' section on s9y.org?

If it is any help: I'm sure it can be done *g*

Best regards,
Garvin

Posted: Thu Feb 08, 2007 12:58 pm
by sorar
Hi,

thanks for your reply.

Yes i read all the 55.htm and the 123.htm and all forum entries i was able to find because normally i try to get things work by my own. :-)

Okay i just started some minutes ago with my second try to get it working.

the blogwrapper.php is now in the blog/ directory. with this code:

Code: Select all

<?php
  ob_start();
  chdir("blog");
  require("index.php");
  chdir("..");
  $serendipity_contents = ob_get_contents();
  ob_end_clean();
?>
when i tryo to open a entry it tries to load (how you wrote :-) )

http://mypagebla.com/blog/blogwrapper.p ... known.html

but the side stays empty :-(

i got in my htdocs/index.php the

Code: Select all

require('blog/blogwrapper.php'); 
this is alos working.

and the IndexFIle points to

Code: Select all

blogwrapper.php
which is based in the blog/ dir.


thanks in advance

Posted: Thu Feb 08, 2007 1:12 pm
by garvinhicking
Hi!

Are you able to give full URLs so I could see for some things?

So now you set indexFile to 'blogwrapper.php', and that file is in the blog/ directory, right?

If so, you need to adapt the code in blogwrapper.ini and remove the 'chdir' calls, as the file is already called frm that directory! Or, better, change the chdir() so that it uses an absolute path, then you can still include that file from within your index.php file of your root site directory.

HTH,
Garvin

Posted: Thu Feb 08, 2007 2:11 pm
by sorar
hi,

i wrote you a pm with the full urls and descriptions.

now i got my blogwrapper.php based in blog/ and in it i putted the full paths to my blog installation and to the root directory of the original page (like: /usr/local/apache2/htdocs/....).

but its still giving me a blank page hrhr.

thanks

Posted: Thu Feb 08, 2007 2:51 pm
by garvinhicking
Hi!

Do you have the PHPs display_errors enabled? A blank page might mean fatal errors you are simply not seeing becaose of display_errors=off?

Regards,
Garvin

Posted: Thu Feb 08, 2007 3:41 pm
by sorar
Hi,

Yes i got them enabled, but no errors are shown.

Strange.
Regards,