Multiple Sites with One Library
One Phile Multiple Sites
This is not related to errors. If you are using standard phile install locations, just ignore this.
I wanted several sites using one Phile Install folder. A structure something like this:
-philesystem
-/datastorage
-/lib
-/plugins
-/temp
-/themes
-/vendor
-/SiteONE
-index.php
-config.php
-default_config.php
-generator.php
-/content
-/SiteTWO
-index.php
-config.php
-default_config.php
-generator.php
-/content
-/SiteTHREE
-index.php
-config.php
-default_config.php
-generator.php
-/content
Each site is accessed with a url
mysite.com/SiteONE
mysite.com/SiteTWO
mysite.com/SiteTHREE
I made these adjustments in index.php
for the site. No modifications to core; however, also need plugin to "fix" the theme url.
FROM
define('ROOT_DIR', realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
define('CONTENT_DIR', ROOT_DIR . 'content' . DIRECTORY_SEPARATOR);
define('CONTENT_EXT', '.md');
define('LIB_DIR', ROOT_DIR . 'lib' . DIRECTORY_SEPARATOR);
define('PLUGINS_DIR', ROOT_DIR . 'plugins' . DIRECTORY_SEPARATOR);
define('THEMES_DIR', ROOT_DIR . 'themes' . DIRECTORY_SEPARATOR);
define('CACHE_DIR', LIB_DIR . 'cache' . DIRECTORY_SEPARATOR);
TO
define('SYSTEMFOLDER', 'philesystem');
define('ROOTSITE_DIR', realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
define('ROOT_DIR', realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
define('ROOTSYSTEM_DIR', realpath(dirname(ROOT_DIR)) . DIRECTORY_SEPARATOR .SYSTEMFOLDER. DIRECTORY_SEPARATOR );
define('CONTENT_DIR', ROOT_DIR . 'content' . DIRECTORY_SEPARATOR);
define('CONTENT_EXT', '.md');
define('LIB_DIR', ROOTSYSTEM_DIR . 'lib' . DIRECTORY_SEPARATOR);
define('PLUGINS_DIR', ROOTSYSTEM_DIR . 'plugins' . DIRECTORY_SEPARATOR);
define('THEMES_DIR', ROOTSYSTEM_DIR . 'themes' . DIRECTORY_SEPARATOR);
define('CACHE_DIR', LIB_DIR . 'cache' . DIRECTORY_SEPARATOR);
Theme URL issue
Note the theme url assigned to twig variables also needs revision; however, I was able to do this in a plugin without changing the core. I just put the following secition in my Jaccms plugin. Basically you just need this in a plugin:
if ($eventKey == 'template_engine_registered') {
$data['data']['theme_url'] = dirname($settings['base_url']).'/'.SYSTEMFOLDER.'/'. basename(THEMES_DIR) .'/'. $settings['theme'];
}
Probably a better way, but for now that works and did not impact any other parts of phile.
Also works for the whole thing being in a subfolder. i.e.
mysite.com/testsites/SiteONE
mysite.com/testsites/SiteTWO
mysite.com/testsites/SiteTHREE
You can also view my config files