Jump to content

Best practice for building two sites on the same processwire install


blanco
 Share

Recommended Posts

I'm building two sites that shares the same front end, templates, modules etc. It's just the content that will differ.

What is the best practice for building this locally. I'm thinking of just duplicating the database, and switch between the two in config.php. Is this practice considered good? Is there a risk of overwriting files/images when uploading? 

Thanks!

 

 

Link to comment
Share on other sites

Thanks!

Option #1 doesn't really fit my needs as I will end up with two copies of the same site in different folders. 

I have tried another option mentioned in this thread: 

I just switch databases in config.php together with the config->paths->assets, and it seem to work fine. 
Do you see any problems with this setup? 

 

 

Link to comment
Share on other sites

I want one single pw install. But I want to have a method for just switching between two databases when developing locally. So far, the solution I mentioned above seem to do the trick. I have added this config.php:

else if($domain == "sitetwo.com"){

    $config->dbHost = '127.0.0.1';
    $config->dbName = 'site_two';
    $config->dbUser = 'root';
    $config->dbPass = 'root';
    $config->dbPort = '3306';

    $config->paths->assets = $config->paths->site . 'assets_two/';
    $config->urls->assets = $config->urls->site . 'assets_two/';

    $config->paths->files = $config->paths->site . 'assets_two/files/';
    $config->urls->files = $config->urls->site . 'assets_two/files/';

    $config->paths->cache = $config->paths->site . 'assets_two/cache/';
    $config->urls->cache = $config->urls->site . 'assets_two/cache/';

    $config->paths->logs = $config->paths->site . 'assets_two/logs/';
    $config->urls->logs = $config->urls->site . 'assets_two/logs/';

}

$domain is just a variable that I set manually, to switch between the two databases/sites. Is this a good or bad approach?

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...