Share blog entries between separate installations

Having trouble installing serendipity?
Post Reply
ldb
Posts: 4
Joined: Fri Sep 19, 2008 4:02 pm

Share blog entries between separate installations

Post by ldb »

Hello,

Sorry if this has been answered, but I could not find anything related to my question when searching the forums.

I am new to serendipity and would like to know if its possible to share blog entries between web sites.

For example, our client currently has a serendipity blog, but would like to use the same database for their current blog on another web site. The reason for this is that they would like to have the same back end data (posts, authors, etc) but a different look and feel for each site.

So, for example this is how each blog would be accessed:

http://www.client-site1.com/blog
http://www.client-site2.com/blog

Each site like I said uses the same blog entries, etc -- they just need different skins. Each site is in a virtual host container.

Is this possible? And if it is, what is the recommended way of doing this? I found some posts related to a "shared" environment, but I'm not entirely convinced this is the right way to do things. I believe my situation doesn't need to be that complex. Is there a "simple" solution?

Thanks for any help!
azel
Regular
Posts: 265
Joined: Thu Apr 21, 2005 4:28 am
Contact:

Post by azel »

I believe you could have two installations in a database, just have a different prefix for each one (say serendipity1_ and serendipity2_). Then you just install the LJ/Myspace/Serendipity update plugin. And now when you post an entry on the first site, it should automatically post to the second site.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Share blog entries between separate installations

Post by garvinhicking »

Hi!

You should solve that differently, by only using one serendipity installation. and using for example the plugin "Extended options/properties for categories" and then you can assign different template sto different categories.

You could also use different subdomains that all point to the same VHost, and then write a very simple event plugin that switches $serendipity['template'] depending on the $_SERVER['HTTP_HOST'] that is currently used.

With two different installations, I don't see a way to really share that, apart from using advanced techniques like MYSQL5 Views.

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/
ldb
Posts: 4
Joined: Fri Sep 19, 2008 4:02 pm

Re: Share blog entries between separate installations

Post by ldb »

Thanks for the quick reply!

What I ended up doing is writing a script to simply copy the relevant data from one database to another. This worked, but I am having a strange problem where characters from the original database are showing up as � in Firefox and boxes in IE. What could be the cause of this? Any suggestions on how I could fix it?
garvinhicking wrote:Hi!

You should solve that differently, by only using one serendipity installation. and using for example the plugin "Extended options/properties for categories" and then you can assign different template sto different categories.

You could also use different subdomains that all point to the same VHost, and then write a very simple event plugin that switches $serendipity['template'] depending on the $_SERVER['HTTP_HOST'] that is currently used.

With two different installations, I don't see a way to really share that, apart from using advanced techniques like MYSQL5 Views.

Regards,
Garvin
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Share blog entries between separate installations

Post by garvinhicking »

Hi!

This means your script is not using the proper DB charsets like s9y does. Make sure your charsets match and the collations of your SQL connection do as well.

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/
ldb
Posts: 4
Joined: Fri Sep 19, 2008 4:02 pm

Re: Share blog entries between separate installations

Post by ldb »

Yup. I was set to latin1 whilst the db was set to utf8. That's fixed.

I'm not liking the idea of copying my tables from one db to the other, since that opened some more problems (sharing comments to entries, for instance).

So, how difficult would it be to tell serendipity to only use the database connection for pulling data related to blog entries (including authors, categories, etc). It appears you also store information related to the templates in the database?

So, for example, I'd like to tell serendipity to not use any template configuration options from the database. Doesn't appear at a glance that this would be too difficult. For instance, I'm looking at functions_smarty.inc.php

Code: Select all

function serendipity_smarty_init($vars = array()) {
    global $serendipity, $template_config;

    if (!isset($serendipity['smarty'])) {
        $template_dir = $serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template'];
I see in the database in the serendipity_config table a serendipityPath config value. Is this the value that $serendipity['serendipityPath'] is set to? If so, could I basically just override that value in serendipity_smarty_init and set my new path? Then, I could just set the database connection parameters to use the 'master' database, and I could essentially have 2 installations (the original installation would remain a vanilla install), each with their own skins, but using a single database.

Would that work?



garvinhicking wrote:Hi!

This means your script is not using the proper DB charsets like s9y does. Make sure your charsets match and the collations of your SQL connection do as well.

Regards,
Garvin
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Share blog entries between separate installations

Post by garvinhicking »

Hi!
So, how difficult would it be to tell serendipity to only use the database connection for pulling data related to blog entries (including authors, categories, etc). It appears you also store information related to the templates in the database?
Again, I can only recommend what I wrote in my first posting. The problems you now state are exactly the reason why I said that there is no other way than to use a singular s9y installation. You should really go that route.
I see in the database in the serendipity_config table a serendipityPath config value. Is this the value that $serendipity['serendipityPath'] is set to? If so, could I basically just override that value in serendipity_smarty_init and set my new path? Then, I could just set the database connection parameters to use the 'master' database, and I could essentially have 2 installations (the original installation would remain a vanilla install), each with their own skins, but using a single database.
You would still need to do a lot of synchronization of databases and filesystems. I don't see that this would work.

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/
ldb
Posts: 4
Joined: Fri Sep 19, 2008 4:02 pm

Re: Share blog entries between separate installations

Post by ldb »

garvinhicking wrote:Hi!

Again, I can only recommend what I wrote in my first posting. The problems you now state are exactly the reason why I said that there is no other way than to use a singular s9y installation. You should really go that route.

You would still need to do a lot of synchronization of databases and filesystems. I don't see that this would work.

Regards,
Garvin
I totally wasn't listening.

I followed your directions, modified some existing plugin code, and it works like a charm!

And it only took about 10 minutes!

Thanks a lot!
Post Reply