Page 1 of 1

Only one category served from another domain

Posted: Wed Mar 07, 2007 1:29 pm
by dennispopel
Hello,

I have the following requirement:
We use s9y as a centralized blog system from several sites (ie, the post and comments stuff goes on one domain, while other our sites connect to the main DB and display the posts relevant to their categories only). On those sites we have our own post comment forms which again communicate directly with the central DB.

Of course, with this setup we don't have all the advanced features like archives and feeds.

Is there any possibility to keep the current setup (one central DB) but install s9y on these other sites and make s9y serve only one or several categories from the main DB?

The point here that with this scheme, editors and moderators have one place (one domain) to work with. And multiple spinoff sites show information only relevant to their topic filtered by category - and they look like real s9y, standalone installations, but work with the central DB.

Is this possible? Or does this require some substantial code changes so that some custom solution might be more feasible instead of s9y?

I am not familiar with s9y code, just wondering if any investigation into this is feasible.

Thanks!

Re: Only one category served from another domain

Posted: Wed Mar 07, 2007 1:45 pm
by garvinhicking
Hi!
Is there any possibility to keep the current setup (one central DB) but install s9y on these other sites and make s9y serve only one or several categories from the main DB?
That depends on how much influence you have. If you can make all sites point to the central s9y installation document root (or symlink those files into the same directory) you could make that work.

You would have to either create a little plugin or edit the index.php file to set an initial $serendipity['GET']['category'] depending on the VHost you are currently listening on.

Something like:

Code: Select all

if ($_SERVER['HTTP_HOST'] == 'category1.myhost.com') {
    $serendipity['GET']['category'] = $_GET['category'] = 3;
}
That would then set a fixed category #3 on that HTTP Host.

In the s9y configuration you would have to enable the option "autodetect HTTP Host". And for it to work properly you would need that each vhost runs s9y into the same directory (like on "/" or on "/blog"). S9y doesn'T handle different directory very well (yourdomain.com/blog vs. categry2.yourdomain.com/serendipity would confuse a single s9y installation).

An other way would be to make copies of the s9y installation files for each vhost, and simply configure the same database and username for all (just copy serendipity_config_local.inc.php to all of your sub-installations, then you don'T need to install each of theme). You'd still need to make the changes that set a fixed category ID, though.

Using the plugin "Extended options for categories" you can also make each blog with its own category look different, by specifying a template for each category.

So, if you know some PHP (which it seems you do, given what you already achieved) you should be able to get that to work, yes.

HTH,
Garvin

Posted: Wed Mar 07, 2007 3:25 pm
by dennispopel
Hello Garvin!

Thank you for prompt reply!
I will do as instructed and see what problems will pop up.

Thank you!