Skip to content

Instantly share code, notes, and snippets.

@n1215
Created April 20, 2015 10:30
Show Gist options
  • Save n1215/0bc4660a84ea98274945 to your computer and use it in GitHub Desktop.
Save n1215/0bc4660a84ea98274945 to your computer and use it in GitHub Desktop.
baserCMS 親テーマもどき
<?php
App::uses('BcAppView', 'View');
class AppView extends BcAppView {
protected $baseTheme = 'hoge';
protected function _paths($plugin = null, $cached = true) {
//プラグインの場合はそのまま
if ($plugin != null)
{
return parent::_paths($plugin, $cached);
}
//キャッシュがあれば返す
if ($cached === true && !empty($this->_paths)) {
return $this->_paths;
}
// app/webrootより一つ上の優先順位に放り込む
$paths = parent::_paths($plugin, false);
$key = array_search(WWW_ROOT, $paths);
$baseThemeDir = WWW_ROOT . 'theme' . DS . $this->baseTheme . DS;
array_splice($paths, $key, 0 , array($baseThemeDir));
return $this->_paths = $paths;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment