Embed paths

Discussion corner for Developers of Serendipity.
Post Reply
JOakley77
Regular
Posts: 6
Joined: Fri Oct 13, 2006 11:47 pm

Embed paths

Post by JOakley77 »

Hi,

After a wee bit of work I've finally got Serendipity embedded into my webapp. The links all stay within the blog.php file and all of that is good. My problems are more then likely easy fixes but I'm new to this software so I need a little hand holding...

1. I use Smarty as the template engine for my webapp. When using the wrapper it's accusing me of trying to declare twice. I turned embed mode on and all. I know why this is happening I'm just curious if there is a way to embed s9y into an existing smarty webapp.

2. I doubled up and created a new header outside of my app for s9y to use. The problem is with the base paths to images and what not. For instance on the calender it's pointing to images inside of `carl_contest` while the powered by image is inside of the `default` folder. I tried changing the option in the admin menu and all of the other images died inside of there.

Probably an easy fix just curious on how to do the above.
Thanks!
JOakley77
Regular
Posts: 6
Joined: Fri Oct 13, 2006 11:47 pm

Post by JOakley77 »

Might help if you knew my structure.

root
- blog (s9y)
- cache (for smarty)
- images (site wide images)
- inc (classes/functions/settings)
- template (site template)

As of this moment serendipity has its original structure intact so I haven't changed a thing. I mention this only because of the Smarty issue I was explaining earlier.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

To let s9y use the Smarty object of your webab, the best thing would be to create an event plugin that listens on the 'frontend_configure' event hook and sets $serendipipty['smarty'] =& $your_smarty_object.

So if $serendipity['smarty'] is set, s9y will not include the smarty framework again. You can have a look at include/functions_smarty.inc.php to see how s9y inits the framework (serendipity_smarty_init)?

The second thing is intentional: If a template does not have specific versions of a file, the default images from the 'Default' folder are delivered?

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/
JOakley77
Regular
Posts: 6
Joined: Fri Oct 13, 2006 11:47 pm

Post by JOakley77 »

Thank you for the quick response and sorry for the slow delay (was a busy weekend).

I may be doing this wrong as I haven't tried this before but in my smartyConfig.php file where I initialize Smarty from I tried using $serendipipty['smarty'] =& new Smarty(); or in place of that I tried using $serendipipty['smarty'] =& $smarty; which is the actual object for how I init Smarty in my app.

I'm obviously not using Smarty to its fullest potential by these configuration options but this are my settings as of this moment...

Code: Select all

<?PHP
require($Config['Physical_Path'].'inc/Classes/Smarty/Smarty.class.php');
$smarty 						 = new Smarty();
$serendipipty['smarty']    =& $smarty;
$smarty->caching 			 = false;
$smarty->template_dir		= 'template/';
$smarty->compile_dir 		= 'cache/';
?>
Trying to init s9y this way I'm getting the "cannot redeclare class smarty" error. I tried a little bit of core hacking which I didn't want to do but I would rather have it just integrate at this time =)

As for the default paths you're right. I must have not set an option earlier because it was taking them images from TWO different directories but looking again they are all going to the default.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

You seem to have used "serendipipty" instead of "serendipity". Maybe this already fixes your problem?

Also make sure that $serendipity is a superglobal and that "serendipity_config.inc.php" was included before you set it (because this mentioned file sets $serendipity = array() as one of the first things to prevent some security concerncs)

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/
JOakley77
Regular
Posts: 6
Joined: Fri Oct 13, 2006 11:47 pm

Post by JOakley77 »

I think I found the problem(s).

First off was the COPY and paste from you post with the misspelling :D so that's working just fine but the real problem was with the wrapper I pretty much just copied over that included my configuration which includes the smarty class in it. Yeah, that did it. The only other problem I had was using chdir() and I just forgot to change the directory back to the original directory.

Works now. Images are still broken but that can be fixed easily in my eyes so thank you for the hand holding through that emotional ordeal =)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Great to hear that, and sorry for my copy+paste mistake. *G*

Hope you have fun using Serendipity!

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/
JOakley77
Regular
Posts: 6
Joined: Fri Oct 13, 2006 11:47 pm

Post by JOakley77 »

I love it so far! I'm hoping to port it over to a few different apps in the future to replace the existing stuff I wrote. Once I get down the ins and outs I'm going to be a happy man =)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Great to hear that! If you ever come accross something you want to implement or contribute, give us a honk. :-)

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