1

I want to set the template path specifically for a subdomain - outside of the default_site templates, while still using the same site/entries/data. MSM isn't what I need here and related posts I can find just uses a template group inside of the current set of templates.

So far I have the subdomain loading the site and hitting my conditional in index.php:

if($_SERVER['HTTP_HOST'] == 'sub.domain.com')
{

    $assign_to_config['site_url'] = 'http://sub.domain.com/';
    $assign_to_config['site_name']  = 'admin';
    $assign_to_config['template_group'] = 'home';

    $assign_to_config['global_vars'] = array(
    'subsite_id' => 'admin_site',
    'domain' => 'http://sub.domain.com/',
    'site_name' => 'Admin Portal',
    ); 
}

My main default_site template path resolves as /home/site/public_html/templates/default_site I want the subdomain path to use /home/site/public_html/templates/admin_site

Is there a param I can add to set the template path when coming in on the subdomain? Are any edits needed to .htaccess as well?

Thanks!

0

Yes, you're looking for tmpl_file_basepath

$config['tmpl_file_basepath'] = '/home/site/public_html/templates/admin_site';

You could also consider using FocusLab Master Config, which makes a multi-environment approach much cleaner.

  • Actually that looks like that is only available in the config.php file via $config['tmpl_file_basepath'], not in the index. Testing it in config with the same condition doesn't affect the path either, still loading the default_site templates. Thank you for the master config though, I will look into that now. – ghoward Jan 13 '15 at 16:55

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.