Jump to content

Multi Site - Is it possible to do this with PW


DV-JF
 Share

Recommended Posts

Hi,

I'm trying to set up a multisite with following specifications:

  • 2 different URLs
  • I have to reach the backend via the two URL's (eg. http://example-firstsite.com/processwire/ and http://example-secondsite.com/processwire/) so that i can create different user / editor roles witch only get "their content"
  • I want to use the nearly same template-files on both sites
  • I want to use only one core
  • I want to share some content between the sites
  • I want to have a "child-page based database for persons" witch I can query and use on both sites with it's own url

I tried to use apeisa Plugin Multisite but had to recognize that it´s not possible to use it without having a "master-site"
 

Can you give me any advices how to set PocessWire up to comply with the requirements?

Many greets, Jens alias DV-JF.

Link to comment
Share on other sites

I'm not an expert, and probably others will have better ideas than me, but it seems like you could achieve much of this with URL redirection.

You could simply have http://example-secondsite.com/processwire/ redirect to http://example-first...om/processwire/ .

Then PW has a user system. You could set up different users and have them access specific things. (I've never used it myself but I'm pretty sure)

This way, there's only one core, AND you can "share content". 

I'm not sure if this is the best way, but you could even have different page trees in PW dedicated to the different sites. 

 

  • Like 1
Link to comment
Share on other sites

I'm not an expert, and probably others will have better ideas than me, but it seems like you could achieve much of this with URL redirection.

You could simply have http://example-secondsite.com/processwire/ redirect to http://example-first...om/processwire/ .

This sounds like a plan, but it wont help me, cause I definitely need to have two different URL's even in the PW backend. 

When I have two different page trees how would you share the content? Is there a way to have "one content" on both page-trees?

Greets

Link to comment
Share on other sites

You can have two different installs that share the same core with the first option from here. But they won't share templates as you wanted. You can't share the content of the two trees, because they would be in two different databases, but you can bootstrap on installation from inside the other by bootrapping it http://processwire.com/api/include/.

Link to comment
Share on other sites

I never used apeisa's module, but I think that's the intended behavior. You can also create two trees under "home" on one install, and play with the permissions, so that one tree is shown to some users, and one tree is shown to other users.

Link to comment
Share on other sites

Jens,

You can achieve this with the help of $config->httpHost.

For this to work, your two domains should be bound to the directory where your PW installation resides. Then, in your template, you can check which domain name is used, and serve your users relevant content.

Example:

if ($config->httpHost == "www.example.com") {
    
    echo "You are visiting example.com. Have some content of type A.";    
}
elseif ($config->httpHost == "www.example.org") {
    
    echo "Looks like you are visiting example.org. You get some content of type B.";    
    
} 

Also, to bind your users to a specific domain, you can add a field for a user profile and keep their domain name in it so you redirect your users to the right address.

  • Thanks 1
Link to comment
Share on other sites

  • 3 weeks later...

You can have two different installs that share the same core with the first option from here. But they won't share templates as you wanted. You can't share the content of the two trees, because they would be in two different databases, but you can bootstrap on installation from inside the other by bootrapping it http://processwire.com/api/include/.

OK, I've to come back to this topic as things going to be serious:

I've decided to set up two sites with method #1 - http://processwire.com/api/modules/multi-site-support/ and I'm syncing the template-folders 1:1 manually.

Everything works fine for me so far, but now I want to share content between these two different sites but I don´t know how to deal this situation:

On site ONE I've created a search form witch crawls and filters specific sites based on templatefiles and outputs a list of persons. I want to integrate this list and search form into site TWO.

Now I'm wondering if I have to include the index.php (like described here: http://processwire.com/api/include/) cause site ONE and TWO are sharing the same basic installation and (I guess) the same index.php, too.

Any ideas, I'm really confused !?

Link to comment
Share on other sites

You actually can't bootstrap one PW installation from another PW installation, though the idea sounds interesting. If you've got two sites sharing the same core, but running on different databases, then the only way they can share data is by taking a web service approach (the same way you'd share data with any two sites). 

Link to comment
Share on other sites

Ryan isn't there any way of "switching the database" on the template to make the api work with one instead of another?

That sounds like an interesting idea, but that's not currently possible. When PW bootstraps, it loads several things from the database into memory, like template and field definitions, etc. When you make another database connection, you are just connecting to another database and not bootstrapping all of PW. 

  • Like 1
Link to comment
Share on other sites

I wonder if installing both sites in the same database using prefixes would work. 

e.g. s1_users, s2_users (s1,s2 are prefixes)

maybe this structure

e.g. s1_notshared, s2_notshared, shared_users (s1,s2,shared are prefixes)

Both tables are in the same database so the same db connection could access them. Then you can use a hook or code to append the current prefix. In any direction, you'll probably have to implement a solution as I don't believe this is a native solution to your problem.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...