Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

[Is this possible?] : Multiple Site/Directories using One Database

Quote Reply
[Is this possible?] : Multiple Site/Directories using One Database
 
Suppose I have one GLinks site USA.com with 50 categories (one for each state) & multiple sub-categories & listings in each state category.

Would it be possible to have the 'same' directory at USA-Site2.com ?

Since I noticed that in MySQL DB, there doesn't seem to be any field that is storing the installed site's URL, path-info, etc & as such technically one database should work on 2nd GLinks install as well.

Is there any way I might be able to do this?
(actually, I just want to have a state-specific second directory, however, the concept would be the same)

So, as for as listing owners are concerned, they could add a listing on the main site (i.e. USA.com) & their listing will be displayed on the second site as well.

Thank you.

Vishal
-------------------------------------------------------
Quote Reply
Re: [VishalT] [Is this possible?] : Multiple Site/Directories using One Database In reply to
Hi Vishal,

This is no problem at all. You can do a new install and set the database.def to your existing installation.
Be careful not to overwrite it when you use install.cgi, I would either make a copy of the old install or do a regular new install and modify database.def afterwards.
You could also modify an existing installation and remove the URL in the config file so you could use the same script without URL information for multiple sites.

Regards

n||i||k||o
Quote Reply
Re: [VishalT] [Is this possible?] : Multiple Site/Directories using One Database In reply to
As Niko said, this is fine. Just set up the 2nd copy on a fresh DB, and then manually edit /admin/defs/database.def to the other DB detail

One thing to also be aware of is if you use files (images for example). This won't work going across sites, as the paths would be wrong. Just something to be aware of

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [el noe] [Is this possible?] : Multiple Site/Directories using One Database In reply to
Hey Niko,

I was actually thinking of doing 2 fresh installs, then taking DB from the existing site & then playing with it, but wasn't sure of the method. Will try as you suggested.

Thanks.

Vishal
-------------------------------------------------------
Quote Reply
Re: [Andy] [Is this possible?] : Multiple Site/Directories using One Database In reply to
Hey Andy,

For images there are two fields/paths in link-properties:
1. File Save Location
2. File Save URL

If both sites are on the same server (Cpanel setup, if that matters), would it be possible to make images work on multiple installs?

Technically if the images are being displayed using 'File Save URL' they should work.

BTW: What if:
Users aren't allowed to add a listing in the second directory directly. Or at least, if they want to add a listing, they are taken to add a listing page for the main directory.

Would this work or can there be any workaround to make it work?

Thanks.

Vishal
-------------------------------------------------------
Quote Reply
Re: [VishalT] [Is this possible?] : Multiple Site/Directories using One Database In reply to
Hi,

It really depends on your hosting set up. If the websites are under the same FTP account (so same user group and owners), then it should be fine. However, if they are under different users (so have different ownership, you will most likely get errors (as it will be trying to access files owned by another user, which isn't allowed)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] [Is this possible?] : Multiple Site/Directories using One Database In reply to
 
Lets say 'File Save URL' for both sites are set as below:

1. https://usa.com/images/user-uploaded
2. https://usa.com/images/user-uploaded

What if users are required to visit page on main site to add/edit listings, so while storing or removing any images, user will be on the site where main GLinks is installed. & Since user won't be doing any link adding or editing on site-two, they may not even run across hosting account user permission error.


Now the issue comes only when admin wants to display user images in the template on the second site.

For this I was thinking, that since for the second site I set

'File Save URL' link property value to https://usa.com/images/user-uploaded

So, while doing build-all Glinks system (installed on second site) will use URL structure https://usa.com/images/user-uploaded do build template pages.

Any thoughts on making it work like this?

Vishal
-------------------------------------------------------
Quote Reply
Re: [VishalT] [Is this possible?] : Multiple Site/Directories using One Database In reply to
Hi,

The easiest way is just to test it ;) The issue will be around the paths (not URLs, as long as you have the as full URLs and not relative).

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] [Is this possible?] : Multiple Site/Directories using One Database In reply to
Sounds good :)...

Weill test it out & post the results here.

Thank you again.

Vishal
-------------------------------------------------------
Quote Reply
Re: [VishalT] [Is this possible?] : Multiple Site/Directories using One Database In reply to
Hi Vishal,

it makes sense to think global about your whole project for there are a couple of ways you could do things.
As mentioned especially for the image URL if you have the same relative paths you could use relative paths in your config file.
You cannot enter relative paths during setup but after having installed you can edit the config file and enter a reliative path.
If - as Andy said - you are using the same absolute file path on your server that should probably do what you want.

You could for example think of two Domains for you second install which point to the same server path.

you have your main install under https://www.main.domain/
you have you local setup under https://www.local.domain/
you have the same local setup under https://local.main.domain/

Not sure if you could make any benefit from that but defining Cookies beeing valid for main.domain instead of www.main.domain and redirecting users who are logging in to https://local.main.domain/ would allow you to navigate between both domains with different look and feel and just one login process.
I see no need for you to do that for what you describe but as I said thinking about your whole project makes sense because there are lots of options.

Regards

n||i||k||o
Quote Reply
Re: [el noe] [Is this possible?] : Multiple Site/Directories using One Database In reply to
Hey Niko,

As far as listing add/edit (management) is concerned from link owner's point of view, I wont' even allow them to do anything on Second Site. Instead, Main Site will be used for all the user-account functions. aka.. 2 (or as many as 3) sites will share the same database, but second & third site will only offer site-browsing ability for visitors, so at least for now, the main problem that I was thinking I might face was that of displaying link, category and user images from Main Site.

Vishal
-------------------------------------------------------
Quote Reply
Re: [Andy] [Is this possible?] : Multiple Site/Directories using One Database In reply to
Hey Andy & Niko,

--------------------------
IT WORKS.....
So far at least, will do further testing in few days on-site with a bigger database & will try to break the system, using site-visitor behavior.
--------------------------


I think just jumping into it & testing it out was much easier & actually less worrisome.. :)

Here are the steps:

1. Main Site: Existing install with sample db of 15 categories & 20 test links. (Link Properties & Category properties have lots of additionally added data-fields)

2. Second Site: On Second install, under:
Admin -> Setup -> SQL Server: I change the database info to that of Main site & selected 'Load table info from an existing set of tables (or resync the def files if you have changed your defs manually).'

Did 'Rebuild Tables' & 'Rebuild Search'. (I kinda did this after every step)

3. Under Database -> Category Properties -> 'Resync Database' & did this for Category, Links, User & Reviews.

4. Plugin -> Installed, Andy's ULTRAGlobals Plugin.

5. I THINK THIS WAS THE STEP THAT WAS BIGGEST CONCERN INITIALLY.
For Second site: Database -> Link Properties -> User Image Field -> Edit

File Save Location:
I HAD to change this, so I used the path of a folder on this domain. (As Andy guessed, GLinks gave me permission error when I used Main Site's path.)

File Save URL:
For this, I actually copied the URL for MAIN SITE. i.e. same value as in Main Site's User Image field.

& now I use Andy's global to call for image on Second Site (for links added in Main Install)

<%if Photo%>
<img src="<%Plugins::ULTRAGlobals::Get_Image_URL($ID,'Photo','Links')%>" />
<%endif%>

& it works :).. i.e image is being displayed..

--------------------------------------------------------

Before I can use this for the live site, I am still going to test this further - however that will be after 3 to 4 weeks, once the site is ready & I can follow steps for user-testing. Will post results on here, once it is done.

Note: I also noticed that if I were to try to modify any listing/category/user from Second Site's GLinks admin interface it would cause a problem with that listing, especially with the image field, but I suppose considering the settings in 'File Save Location:' it was expected.
--------------------------------------------------------

I really love GLinks more and more every day.. even after this many years, we have yet to use GLinks to even half its potential.


Thanks again you guys :)

Vishal
-------------------------------------------------------