One last hurdle while embedding - Duplicate Smarty

Found a bug? Tell us!!
Post Reply
oeli
Regular
Posts: 19
Joined: Sun Apr 17, 2005 10:27 am
Location: Vlissingen, The Netherlands
Contact:

One last hurdle while embedding - Duplicate Smarty

Post by oeli »

I've almost got embedding working the way I want it to (from 2 different directories, site in one, s9y in subdirectory).

I used the approach where I first include serendipity, using outputbuffering, and save the output in a variable. Then I include my CMS stuff, and use the variable to put the content into place.

Almost works. There's one problem: I get a fatal error on a duplicate definition of the Smarty class, which makes sense, both the CMS and s9y are Smarty based.

The dirty solution was to remove one of the includes of Smarty, which makes both systems use the same Smarty.

The correct solution in my opiniion, would be a possibility in either the CMS or s9y to configure what Smarty.class.php to use. If I can tell s9y to use the one from the cms, it will work because require_once will then prevent the class from being loaded twice.

s9y is the best place to fix this, since s9y is included first and the cms is included second.

Would it be easy to make this a little bit more configurable? I guess it's a matter of defining SMARTY_DIR someplace other than functions_smarty.inc.php, or have it do an if(defined)) check so I can define it myself before including s9y.

What do you think?
oeli
Regular
Posts: 19
Joined: Sun Apr 17, 2005 10:27 am
Location: Vlissingen, The Netherlands
Contact:

Post by oeli »

I realise I posted this in the wrong forum; sorry about that. I don't seem to be able to move it myself.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: One last hurdle while embedding - Duplicate Smarty

Post by garvinhicking »

Hi!

Serendipity only includes smarty, if the $serendipipty['smarty'] object is not set. So you just need to make sure the instance of this object is up and running after the serendipity_config include.

The easiest way would be to use serendipity_config_local.inc.php to set the $serendipity['smarty'] =& $Your_smarty; variable.

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