Skip to content

Instantly share code, notes, and snippets.

@artygrand
Created July 17, 2016 08:53
Show Gist options
  • Save artygrand/656d49941b3a0fd9d1da1526ff6df2ae to your computer and use it in GitHub Desktop.
Save artygrand/656d49941b3a0fd9d1da1526ff6df2ae to your computer and use it in GitHub Desktop.
SyDES plugin: select theme for subsite
<?php
$app->on('after.module', 'pages/view/*', function() use($app){
$parts = explode('/', $app->response->data['fullpath']);
$themes = str_replace(DIR_TEMPLATE, '', glob(DIR_TEMPLATE . '*', GLOB_ONLYDIR));
if (in_array($parts[0], $themes)) {
$conf = $app->config_site;
$conf['template'] = $parts[0];
$app->config_site = $conf;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment