Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-09-02 10:03:08

pepi
New Member
Registered: 2004-09-02
Posts: 9

Multiple sites: one or multiple installs?

Hi all,

I’m new here, and to Textpattern, I’ll try and not be too clueless but please bear with me in case I am :)

I have installed Textpattern in a temporary test section of my site, just to get familiar with it. I’d tried Blosxom, Movable Type, Nucleus, needless to say, this just beats them all and is so nice and easy to use.

I have several domains on one hosting package, as “addon domains”, so they point to subdirectories of my main /home/user/www/ area.

My question is, what is the best way to go about having multiple sites with Textpattern?

I have searched the forums and on google, came up with some replies on this already, but it’s still not too clear to me, whether the easiest approach is:

a) to have multiple installations, one for each directory corresponding to a site (and domain)

or,

b) to have only one central installation, and then “slice up” the sites as different sections

or, again, if I understood correctly,

c) if it’s possible to “simulate” multiple installations by having multiple config.php and a few other associated files, even without full separate installs? (ie. like Dean says here: http://forum.textpattern.com/viewtopic.php?id=3220 )

I’d rather avoid option a), if possible, even if after all an install is only about 500KB so it would take up 5MB to have 10 different installs. It just sounds like an unnecessary complication considering all domains are in the same server space, same control panel, etc.

With option b), I’d just need the sections to work as entirely different sites on different domains, and I would need to give access to other users (as “freelancers”, can post and edit own posts) to the Txp area of some of those domains, but not others. Would that be possible?

Finally, option c)… I simply haven’t understood how it works. I suppose I can just give it a try in the testing area, but before doing that, I just thought I’d ask, does anyone have more details about how I should set that up?

apologies if this sounds too dumb a question, I’d just really appreciate some more advice… thanks!

Offline

#2 2004-09-02 10:52:19

pepi
New Member
Registered: 2004-09-02
Posts: 9

Re: Multiple sites: one or multiple installs?

An update to my post above – I just gave option c) a try, creating another directory, with its own textpattern directory, and copying in it only the files Dean said in that post:

config.php
css.php
index.php
textpattern.css
/img/

So, I got the first Textpattern full install in /test/txp1/, and the second (partial) one in /test/txp2/, with its /test/txp2/textpattern directory containing only those files as listed above, and the $txpcfg[‘txpath’] variable in the config.php file pointing to the first full /textpattern/ directory in /test/txp1/

When I log in to the txp2 install, I get the very same configuration as in txp1 , same user, login, paths, posts, etc.

Dean says the $txpcfg[‘doc_root’] in the second “partial” install should point to the to the individual site’s doc root – I’m not sure if that means the subdirectory?

In the config.php in /test/txp2/textpattern, I tried both paths for that variable – /home/user/www and /home/user/www/test/txp2 – and for some reason, I get the same result with both. Still the same installation with the same content.

Is that’s how it’s supposed to be? If so, what else do I have to configure to make the second install work as as separate one? Or am I doing something wrong?

Offline

#3 2004-09-02 12:09:13

obeewan
Archived Plugin Author
From: Stockholm, Sweden
Registered: 2004-08-12
Posts: 319
Website

Re: Multiple sites: one or multiple installs?

To splice them up you need also need to add prefix to the tablenames but without beeing able to ftp threw this computer at work I can’t check the config.php of what to change.

Meaning you need different prefix for the two-ten different sites so they use their own tables but the same database.

If you can post your different config.php’s it would be easier to check it out.


Plugins: ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1

“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu

Offline

#4 2004-09-02 13:43:42

pepi
New Member
Registered: 2004-09-02
Posts: 9

Re: Multiple sites: one or multiple installs?

obeewan – thanks for that, now I think I get why the content looks the same, if it’s the same tables being accessed…

Here’s my config.php files – for txp1:

<?php
$txpcfg[‘db’] = ‘user_txp’;
$txpcfg[‘user’] = ‘user_me’;
$txpcfg[‘pass’] = ‘xxxx’;
$txpcfg[‘host’] = ‘localhost’;
$txpcfg[‘table_prefix’] = ‘’;
$txpcfg[‘txpath’] = ‘/home/user/public_html/test/txp1/textpattern’;
$txpcfg[‘doc_root’] = ‘/home/user/public_html’;
$txpcfg[‘secret_word’] = ‘xxxx’;
?>

For txp2:

<?php
$txpcfg[‘db’] = ‘user_txp’;
$txpcfg[‘user’] = ‘user_me’;
$txpcfg[‘pass’] = ‘xxxx’;
$txpcfg[‘host’] = ‘localhost’;
$txpcfg[‘table_prefix’] = ‘’;
$txpcfg[‘txpath’] = ‘/home/user/public_html/test/txp1/textpattern’;
$txpcfg[‘doc_root’] = ‘/home/user/public_html/test/txp2’;
$txpcfg[‘secret_word’] = ‘xxxx’;
?>

basically only the paths change. If I need to add a prefix for the second partial install, how do I do that now?

I’ve tried adding a prefix in the txp2 config.php, but after that, when I login to txp2/textpattern, I get mysql and php errors all over the place. I guess because the sql tables with that prefix are just not there. The second “install” was not really an install- I just copied those files, without doing the setup as for the proper full install, so no different set of tables was created.

If I do everything from scratch, and specify a prefix for the txp1 installation, then I guess I’d still have the same problem.

Do I have to manually create those tables with a different prefix?

Or… can I run a copy of setup.php from the 2nd partial install? I hadn’t thought that was possible, so perhaps that’s what I got screwed up?

(to clarify my idea about organising the multiple sites – I realise I don’t really need this method for having multiple sites in which I’m the only author, different sections from the main install will do very nicely – but for the couple ones for which I plan to have more authors, I do need to choose between this way of having a partial install, or a full separate install, given there’s no way to limit one author’s privileges to one section only)

Last edited by pepi (2004-09-02 13:44:21)

Offline

#5 2004-09-02 14:38:10

pepi
New Member
Registered: 2004-09-02
Posts: 9

Re: Multiple sites: one or multiple installs?

Oh, I found another post by Dean on this:

http://forum.textpattern.com/viewtopic.php?id=26

so apparently it would all be very simple if I was allowed more than one database, which I’m not.

I tried running a copy of setup.php from the second install, doesn’t work, php errors, it doesn’t find the include files. (I guess because they’re not in that 2nd textpattern dir, so textpattern’s own include call is calling up the global include path…)

I reckon I could manually duplicate the set of tables from the first install (via PhpMyAdmin), change their name by adding a prefix, and then specify that prefix in the second install config.php file. If anyone has a simpler suggestion… :)

Offline

#6 2004-09-02 18:22:27

obeewan
Archived Plugin Author
From: Stockholm, Sweden
Registered: 2004-08-12
Posts: 319
Website

Re: Multiple sites: one or multiple installs?

Well .. If you are going to install I think you need the full release, allthough when done you can remove all but thoose essential files. But the way with PHPMyAdmin etc you described works too ..


Plugins: ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1

“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu

Offline

#7 2004-09-03 12:22:39

pepi
New Member
Registered: 2004-09-02
Posts: 9

Re: Multiple sites: one or multiple installs?

Thanks! I don’t know why I hadn’t thought about that (full install, then remove all but essential files). That’s definitely the simplest method.

Just tried it on my local installation and it works perfectly. I also set up an alias for the /txp_img/ folder so I don’t have to duplicate that in the partial install.

Offline

#8 2004-09-30 17:23:59

anselor
New Member
Registered: 2004-09-29
Posts: 2

Re: Multiple sites: one or multiple installs?

Ok, i may be a bit late coming into this, but I figured out how to get multiple sites working on a single install. It wasn’t too bad, just had to dig through some source to figure out you can do this.

In the /textpattern/ directory i created a directory users and a directory for each user inside. So, for example, You’d have this:
/textpattern/users/userA
/textpattern/users/userB

In each of the user directories I have a config.php with their settings.

I replaced /textpattern/config.php with a simle check of $_SERVER[‘SERVER_NAME’].
For example, you could do this:
$server = $_SERVER[‘SERVER_NAME’];
$domains[‘mydomain1.com’] = “userA”;
$domains[‘www.mydomain1.com’] = “userA”;
$domains[‘hisdomain.com’] = “userB”;
$domains[‘www.hisdomain.com”] = “userB”;

require($_SERVER[‘DOCUMENT_ROOT’].”/textpattern/users/”.$domains[$server].”/config.php”);

That’s a very simplified example, you’d probably want to add checks and and stuff, or maybe link to a database, up to you really.

In each user-specific config.php I specify a unique table prefix for that user. You can, then, run setup.php for each domain to create the database tables and get it up and running.

The only other thing you have to do is to setup the /images/ to load correctly. To do this, i created a directory inside of images for each user. For example:
/images/userA
/images/userB

Then, if you go into the database and modify the [tableprefix]txp_prefs table. Change the row with the name ‘img_dir’ to point to the correct user-specific image directory. For exampale, if i set the table prefix for userA to just be userA, i’d goto the userAtxp_prefs table and change it from ‘images’ to ‘images/userA’

That should let you power multiple domains independently off of one install of Textpattern.

Offline

#9 2004-09-30 23:10:56

kennethlove666
Member
From: arkansas
Registered: 2004-04-27
Posts: 107
Website

Re: Multiple sites: one or multiple installs?

anselor – haven’t tried it myself, but looks like a truel ingenious way of doing it. kudos.


Listen to Kenneth

Offline

#10 2005-11-08 23:01:58

tinyfly
Member
From: Dallas, Texas
Registered: 2004-05-10
Posts: 462
Website

Re: Multiple sites: one or multiple installs?

Is this information still relevant? I would like to do this with TXP 4.0.2 is it possible?

Offline

#11 2006-02-28 03:24:58

jamiew
Archived Plugin Author
From: NYC
Registered: 2005-01-08
Posts: 74
Website

Re: Multiple sites: one or multiple installs?

i’m about to try it out on 4.0.3, will let you know how it goes.

Offline

#12 2006-02-28 07:03:38

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,122
Website GitHub Mastodon Twitter

Re: Multiple sites: one or multiple installs?

> pepi wrote:

> $txpcfg[‘secret_word’] = ‘xxxx’;

Is there something that I have missed?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB