Multiple sites, one database

DaMadBoy

New Member
If I was to create multiple sites to use one database how much of the code would I need to change?

I know that the URL in the settings menu would need to be changed so it isn't reliant on the one in the database but is there anything else that would need to be changed in order for it to work flawlessly?
 

Basti

Administrator
Staff member
When you install your list, by default the db prefix is "VL", so tables look like VL_sites
change that prefix when installing to something else, e.g VL1, so tables look like VL1_sites
 

DaMadBoy

New Member
My site is already installed with the default prefix, how would this help exactly? Surely all sites would still be reading from the same part of database no matter what the prefix?
 

Basti

Administrator
Staff member
You said you want to use the same database for multiple lists. Then you HAVE TO change that prefix. Because your already installed list uses "VL" as prefix, the next list you install will need to have a different prefix. And that is all there is to it
 

DaMadBoy

New Member
I'm still fairly new to databases and PHP so sorry if I seemed rude or anything. Just wanted to know for sure, if a site gets added to one site, will it be displayed on all the other sites as well using this method?
 

Bart

Active Member
This is how it works, if you use the prefix of VL1_ your database will show these tables (examples only)

VL1_users
VL1_sites
VL1_settings

and if you use the same database for another with with a difference prefix it will be like:

VL2_users
VL2_sites
VL2_settings

so in theory you will end up with:

VL1_users
VL1_sites
VL1_settings
VL2_users
VL2_sites
VL2_settings
VL3_users
VL3_sites
VL3_settings

and that's 3 different sites using the same database but each have their own chunk of it and they do not share between themselves.

I hope this explains it a bit clearer.
 

Basti

Administrator
Staff member
Ah, so you want to show the sites from one list on the others automatical? That wasnt clear at all in your other posts.
That is not so easy and needs some kind of shared tables.

Basicly you would have to install your 2 lists ( with 2 different prefix ), then on the second list you need a plugin ( which dont exist ) which queries the list 1 database ( sites table ) and not like default list 2 table
 

daannet

Member
If you want a toplist that shows the same content, but another style. You can reupload your Toplist-1 to the server of Toplist-2. Link the skins direct and use not the {$list_url} but http://name.tld/skin/yourskin/**. If you do this your skins need the same name's. Than the database can handle it.

You need to update all the {$list_url} things to http://name.tld/ other wise you will be send to another site each time.
 

DaMadBoy

New Member
Sorry for not being very clear, never was good at explaining what my aims are lol. Thanks for the help guys, I believe I know now what I need to do to get everything working correctly.
 
Top