Page 1 of 1

Smarty call from php file

Posted: Mon Aug 04, 2008 4:31 pm
by Don Chambers
I'm trying to help someone make a minor modification to an s9y install that is embedded. The install does not use index.tpl, but rather a blog.php file that contains a bunch of php as well as all the html, such as <head>, etc.

I need to get {serendipity_hookPlugin hook="frontend_header"} into this file. How do I do that since it is not a smarty tpl file?

Posted: Mon Aug 04, 2008 10:28 pm
by judebert
That's a very old version of s9y, I think.

What you need is the PHP equivalent:

Code: Select all

serendipity_plugin_api::hook_event('frontend_header', &$serendipity);
Untested, of course. And you may need to...

Code: Select all

global $serendipity;
...or even:

Code: Select all

@include $serendipity[baseDir] . 'include/plugin_api.inc.php';
before it works.

Posted: Tue Aug 05, 2008 2:39 am
by Don Chambers
Its not an old s9y install - just a very unusual one. In this instance, embedding was seen as necessary because the blog is only a small component of an existing website.

Posted: Tue Aug 05, 2008 5:40 am
by judebert
Ah. I'm confusing the old theme system, which used some-or-other .php file, with the embedding. Sorry. Did the direct PHP call help?

Re: Smarty call from php file

Posted: Tue Aug 05, 2008 9:54 am
by garvinhicking
Hi Don!

The blog.php file should be from within s9y, right?

In fact, even when s9y is embedded it should use a template's index.tpl file and render it. Thus, you shouldn't need to use any PHP.

However, it might help if you can post the blog.php here or somewhere else to look at.

Judeberts suggestion should work, but it would require a PHP coder to really understand the process of the blog.php...

Regards,
Garvin

Posted: Tue Aug 05, 2008 9:29 pm
by Don Chambers
Thanks Jude & Garvin. Jude's suggestion worked. Only need the global $serendipity & the php version of the hook. The @include gave me the white screen of death, but did not turn out to be necessary.