I have been playing around with multisite recently and wondered - what would be the best way to share some template logic between multisite instances?
I have an upcoming project where two different sites would have different users and setups etc but they need to share some basic similarities in look and functionality. I was thinking of setting up the sites as separate sites under multisite and then finding a way of sharing something such as a 'main.php' file that each template calls. I would also like to share a 'base.css' file between the sites as well. I want to do things this way because they want the potential to be able to expand into more sites over time - up to 5 or so.
What would be the best way of doing this?
Thanks in advance.
You can use symlinks, but I also don't see any problem with just referencing the file you want directly. I'm not sure which multi site method you are using, but assuming you are using the built-in method with multiple site- directories. So if you want to include your /site-other/templates/home.php to include /site/templates/main.php, then you would just do this in your home.php:
include($config->paths->root . 'site/templates/main.php');
Likewise for your base.css file, except that you would use a URL instead:
<link rel='stylesheet' type='text/css' href='<?=$config->urls->root?>site/templates/styles/base.css' />