Support ⇒ Requests :: Archives ⇒ Multiple Domains :: Archived ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum IndexRequests

Archived ⇒ Multiple Domains

Can I use one cpgnuke install to manage content on multiple domains. (they may have different blocks/themes etc and may share some news content) ?

If not, is this something that is planned soon?

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):

Currently no, and no immediate plans - you can run multiple sites from one sql database by using different prefixes, but sharing does require major work.

There is a topic with considerable discussion somewhere in here regarding that -> search.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):

That would be a good grabber for some people who have limited amount of hosting space. The same size website for two domains. Intrieging

admin @

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux/1.3.33 (Unix)/4.0.20-standard/4.3.10/8.2 (Upgrading to 9.0.5)

Thanks Phoenix,

I've searched again and still haven't found the discussion. Sad

I agree it would be great for people with limited space. other advantages: *easier maintainence (1 upgrade/fix)
*easier to upgrade/customize
*and of course save time on shared information...

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):

I'll have a look - a topic like that can be a little hard to find, provided it wasn't in the old forum.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):

Several other topics about multiple use of database, but not any great depth in discussion - this is the major one.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):

I was giving this some thought and I figured out that you might be able to do it this way:

Website A is connected to Database 1-set A using files A-set 1
Website B is connected to Database 1-set A/B (both) using files A-set 1/2 (both)

There will be one database with two tables for things you don't want to share. TO accomplish this, we edit ONLY the files that access these tables hence file set 2. Once the files are editted properly, website b will just point to a different index file.

The directories will be bigger but not as much as having two sets of every file.

Correct me if this won't work as I was just thinking about this for 30 seconds. It actually took me longer to type it out than it did to think about it. Laughing

admin @

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux/1.3.33 (Unix)/4.0.20-standard/4.3.10/8.2 (Upgrading to 9.0.5)

Thank you for your quick replies.

Phoenix, that is similar to what i want. i've contacted the poster to see if he has other ideas.

Scorchsta, are you saying to use one database and have 2 copies of the files and just edit the prefixes for the common files? or only one copy of the files with different index.php names and some files are duplicated- the problem with that is that then they are in the same directory- can we point to seperate files and consider that a new domain?

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):

I'm going to throw in some info about what I've done on my site in case it helps.

My situation is not the same as yours but in many ways is similar. My site uses one domain - not multiple domains - but is essentially a main site with subsites.

I wanted a site where members could log in (once) to the main site and then go to their 'local' subsite. I wanted some info to be specific to the local site and some to be shared.

Members log into the main site and then use links to get to the subsites (only the main site and one subsite at the moment, though potentially this could reach 36 subsites - the site has only been up a week).

For example, each 'site' has it's own news, events, and other modules but share forums, contact us, docs, etc.

The subsites live in their own subdirectory of the site e.g.
Main site -
Subsite one -

This is an oversimplification, but basically it works by adding a new table prefix in config.php. I call it $local_prefix. I then go through all the code and replace $prefix by $local_prefix where I want tables to be specific to their subsite.

The main site config.php has $prefix and $local_prefix values which are identical.
Each subsite uses the same $prefix (and $user_prefix) as the main site but has a different $local_prefix.

When deciding which modules/tables it's possible to share you have to be very careful. For example, the Polls/Stories/Topics are linked so don't expect to (easily) be able to have shared polls but individual news and vice versa.

Also, I decided to have the forums module shared because things like Members List, Private Messages, User Groups are closely linked to it and these have to be shared. No separate forum module on my site.

I build the database tables for each subsite manually. Using phpmyadmin to copy the table structure with the new prefix. Of course it would be possible to build an installation routine for each subsite but this is still very much a work in progress.

The code is basically a copy of the mainsite in each subdirectory. This means there is a lot of redundant code but space is not a major consideration for me - I was more concerned about the number of tables and general mess on the database. Also, on a busy site the size of the database is likely to be the major issue, spacewise.

I also use a couple of other variables in the config.php - $subsite, which holds the name of the subsite and $ismainsite, which is set to show if this is the main site or not.

These variables mean the code knows which subsite it is in.

Problems that spring to mind are:
This involves a lot of code changes. Whilst the code changes are simple this gives plenty of room to introduce errors, typos etc. Easy to forget to set the $local_prefix global in a function. If you haven't changed a $prefix to $local_prefix you will get some very strange results.

Also, when updating to the next release you have to do it all again...

Allowing a member to log in at one subsite and out of another caused problems. You could log out of the mainsite and find you were still logged in at the subssite. No doubt a cookie problem, I couldn't resolve this without forcing log on/off from the mainsite. I used my $ismainsite global to control this, directing members to the main site log in/out if they were in a subsite. Exascerbating this problem is the fact that I have changed the user cookie so that it is a session cookie, for security reasons. Many of my members use web bars so I force them to log in each time they visit (session cookies die when the browser is closed down - my members forget to log off).

Well, that's my bit thrown into the ring. This is from memory so I'm sure I've missed out a few important facts. I don't pretend that this is the best way to do it but it meets my needs. Like many things, this solution was arrived at in a hurry and I'm sure there are better ways to do it.

This sort of conversion is not for the fainthearted or those unfamiliar with PHP and SQL. You will introduce bugs and have to sort them out. However, it does show what is possible. My site is running very happily at the moment (famous last words). 😉

Maybe a disclaimer on behalf of CPG Nuke is in order here as I have the 'debugger' reference next to my name. I should make it clear that this way of doing things has not bee\n recommended/advised by CPG Nuke and it is quite possible I have introduced errors/security issues by doing it. If anything goes wrong I have only myself to blame - and if you copy me, you only have yourself to blame.

Having said that, I hope this bit of info helps. I'd be very interested to hear other members solutions to this and similar issues.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):

I had been thinking about that (subdirectories and all) but i'm very hesitant to do it because it will be a maintainence nightmare- as you mentioned. Is it possible for you to submit your changes back to the core so that $local_prefix would be a permanent part of the code base? If cpgnuke had multisite ability it would set it further apart from other cmses (hint).

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):

What about using the "Groups" feature to make certain blocks visible to whatever groups are logged in. You won't be able to completely make two seperate sites this way, but it might help split the different groups you're trying to reach.

Just a thought...

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Ubuntu 14.04.1/Apache 2/5.5.38/5.5.9/

The problem is not everyone is a registered user so i will have to trick the system. That is a good start but i need different themes also.

Unfortunately that wont work for me.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):

The thing is that everbody wants something different so my solution won't fit all sizes. The $local_prefix solution works because I know what modules I want to share/have independent.

You might want to share your events, for example, while I want them seperate. To allow different sites to pick and choose what to share would mean having a different prefix for the tables of each module (if you did it my way) and then it's getting very messy.

A system that would allow multiple CPG Nukes where admin could choose which modules shared information and which were independent would certainly be very nice but no doubt complicated to create.

I suspect it's well down the list of the team's priorities at the moment, but posting requests like this shows them there is a call for it.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):

If it's set up once it wouldn't be a big deal to have a different prefix in each module. For the standard user who doesn't need this they have it all set to the default:


for people who want it different they change it to $userprefix='myprefix';

This can even be stored in a database making it easier to maintain.

i wouldn't mind doing some work on this as long as i dont have to recreate it with each new version etc.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):

Phoenix wrote
Several other topics about multiple use of database, but not any great depth in discussion - this is the major one.

This link shows:
"The topic or post you requested does not exist"
Can you give a correct link or is it removed?

I am planning for a group of sites. Each site/domain has different services.It's not necessary for me to share a single database(each site will have its own DB). What I want is when one user creates an account in any of these sites , same account will be created for all sites. Thus though my users need to login again to a different site, but he/she wont need to create a new account.

In summary they should be able to use the same user ID to login to any of these sites.

1. I am a beginner in php/mysql. So guys, can you explain me how to proceed? Especially how to update remote DB when updating local DB?

2. And how can I resolve the issue when 2 different guests in 2 different sites has created same user name(worst case: at the same time)? Each of them will reacieve an activation link.


Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
XP/XAMPP 1.4.9/8.2b

All times are UTC
This forum is locked: you cannot post, reply to, or edit topics. Forum IndexRequests
Page 1 of 2