0

Is it possible to set the template location (when using template files) to refer to a location outside of the system folder?

For example, imagine we have two sites with a shared root, site A and site B:

/public_html/site_a/
/public_html/site_b/

If the primary/default site is site A is it possible to have the templates for site b situated within the site B folder, rather than within the default system folder.

Cheers,

Cole

2

In addition to @Bhashkar's answer you can also set in your config file (/system/expressionengine/config/config.php):

$config['tmpl_file_basepath'] = "/home/account/public_html/templates/";

But I'd highly recommend placing above web root to maximise security: http://ellislab.com/expressionengine/user-guide/installation/best_practices.html

Typically this could be your setup:

(/home/account being your server account root)

  • /home/account/public_html
  • /home/account/system
  • /home/account/add-ons
  • /home/account/templates

Whereas a non-MSM site would utilise "default_site" folder off of the templates folder, for a MSM enabled site, each site name (short name) would appear as folders inside the templates folder. As mentioned in the EE link above, you have to modify your index.php and admin.php to utilise the above web root path.

"system" folder would be the EE system folder (without the templates or third_party folders.

"add-ons" being your third_party folders (modules/extensions/plugins)

$config['third_party_path'] = '/home/account/add-ons/';

I'd also suggest you avoid an MSM setup where you have one site within another, e.g.

/home/account/public_html/domain2

...which can lead to issues with rewrites and www.domain1.com/domain2 urls accessible. A neater more secure setup would be:

  • /home/account/public_html
  • /home/account/domain2/public_html
  • /home/account/domain3/public_html

or

  • /home/account/public_html
  • /home/account/domains/domain2/public_html
  • /home/account/domains/domain3/public_html

Apologies expanded from your original question...!

1

Yes its possible. If you set the Save Templates as Files as Yes under Global Template Preferences, you can see the templates are being saved as file within "system/expressionengine/templates/" [default EE setting] like: [site_short_name]/[template_group_name].group/templates

So for your purpose, the "Server path to site's templates" to be provided as "/public_html/" and just created 2 another directories named with sites short name. Although, it would be done by EE itself. You need to only update "Server path to site's templates" under "Global Template Preferences".

1

You can also fixate your embedding templates with {embed="site_a:_inc/_header"} and that will tell EE where to find your templates. This way you can share all of your templates across multiple sites without having to update those templates individually.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.