You are here:  » Common configs for multiple installs.

Support Forum



Common configs for multiple installs.

Submitted by BobL on Sun, 2012-12-16 14:49 in

Hey David,
Hope all is well and you're feeling better.

I have a question on multiple installs.
I have a top level install and several sub-directory install [same site]

I was trying to use this in configAdvance.php

  $config_feedDirectory = "../../feeds/";
  $config_htmlDirectory = "../html/";
  $config_imagesDirectory = "../../images/";
  $config_logoDirectory = "../logos/";
  $config_includesDirectory = "../includes/";
  $config_scriptsDirectory = "../scripts/";
  $config_templateDirectory = "../../../templates/";

But for some reason I still needed to copy the includes and scripts folders to each install no matter if I put
../ or ../../ or ../../../ I even tried this ./

Submitted by support on Mon, 2012-12-17 13:32

Hi Bob,

It should just be down to a simple mod in includes/common.php since it uses a file_exists() call to determine where it is being included from in order to locate the other files, so assuming that your common /includes/ folder is a level above the multiple installations, in your common version of that file look for the following code at line 8:

    $common_path = "includes/";

...and REPLACE with:

    $common_path = "../includes/";

...and the following code at line 16:

    $common_path = "../includes/";

...and REPLACE with:

    $common_path = "../../includes/";

That should be all it is - /scripts/ should then work once you've incorporated your new $config_includesDirectory variable as required...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by BobL on Tue, 2012-12-18 10:52

Bob L.

Hi David,

I tried that but it broke the main [top level] install.

Submitted by support on Tue, 2012-12-18 11:47

Hi Bob,

I'm not seeing any errors on the site at the moment - but I'm wondering how you wanted to incorporate an actual installation at the top level, as the way includes/common.php works it expects to be called from either

/installation/

or

/installation/admin/

What you could do is use robots.txt as an indicator that you are in the top level installation and then adjust $common_path accordingly. After having made the last modification described above you should now have the following in your common includes/common.php starting at line 2:

  if (file_exists("config.php"))
  {
    require("config.php");
    require("config.advanced.php");
    $common_path = "../includes/";
  }
  else
  {
    require("../config.php");
    require("../config.advanced.php");
    $common_path = "../../includes/";
  }

...so if you REPLACE that with:

  if (file_exists("robots.txt"))
  {
    require("config.php");
    require("config.advanced.php");
    $common_path = "includes/";
  }
  elseif (file_exists("config.php"))
  {
    require("config.php");
    require("config.advanced.php");
    $common_path = "../includes/";
  }
  else
  {
    require("../config.php");
    require("../config.advanced.php");
    $common_path = "../../includes/";
  }

...and it can now be included from any level...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by BobL on Tue, 2012-12-18 12:30

Thanks David,

That worked like a charm.

I was able to remove both includes and scripts from the subdirectory.
Proves you be the man. Thank you for the great support.

Bob L.