コード例 #1
0
 /**
  * Add a path for template
  *
  * Multiple calls to this method without a namespace will trigger an
  * E_USER_WARNING and act as a no-op. Plates does not handle non-namespaced
  * folders, only the default directory; overwriting the default directory
  * is likely unintended.
  *
  * @param string $path
  * @param string $namespace
  */
 public function addPath($path, $namespace = null)
 {
     if (!$namespace && !$this->template->getDirectory()) {
         $this->template->setDirectory($path);
         return;
     }
     if (!$namespace) {
         trigger_error('Cannot add duplicate un-namespaced path in Plates template adapter', E_USER_WARNING);
         return;
     }
     $this->template->addFolder($namespace, $path, true);
 }
コード例 #2
0
ファイル: Views.php プロジェクト: projek-xyz/ci-common
 public function __construct(Module $module, array $data = [])
 {
     $this->engine = new Engine(VIEWPATH, 'php');
     foreach ($module->getList('module') as $mod) {
         if (is_dir($mod_view = $mod->path . 'mod/views/')) {
             $this->paths[$mod->name] = $mod_view;
             $this->engine->addFolder($mod->name, $mod_view);
         }
     }
     if ($currentModule = $module->getCurrent()) {
         $this->engine->setDirectory($this->paths[$currentModule]);
     }
 }
コード例 #3
0
 /**
  * The transformer constructor.
  *
  * Options are:
  *   - "plates" a \League\Plates\Engine instance
  *   - "directory" the directory where Plates will search templates
  *   - "extension" the extension of template files
  * if the option "plates" is provided, options "default" and "extension" are ignored.
  *
  * @param array $options The PlatesTransformer options
  */
 public function __construct(array $options = array())
 {
     if (array_key_exists('plates', $options)) {
         $this->plates = $options['plates'];
         return;
     }
     $this->plates = new Engine(getcwd(), null);
     if (array_key_exists('directory', $options)) {
         $this->plates->setDirectory($options['directory']);
     }
     if (array_key_exists('extension', $options)) {
         $this->plates->setFileExtension($options['extension']);
     }
 }
コード例 #4
0
ファイル: Views.php プロジェクト: bootigniter/project
 /**
  * Create new Views Instance
  *
  * @param array|Module $module
  */
 public function __construct($module)
 {
     if (is_array($module)) {
         $module = array_shift($module);
     }
     $this->engine = new Engine(VIEWPATH, 'tpl');
     foreach ($module->getList('module') as $mod) {
         if (is_dir($mod_view = $module->getPath($mod->name) . 'views/')) {
             $this->add_folder($mod->name, $mod_view);
         }
     }
     if ($current_module = $module->getCurrent()) {
         $this->engine->setDirectory($this->paths[$current_module]);
     }
 }
コード例 #5
0
ファイル: LouisCRUD.php プロジェクト: louislam/louislam-crud
 public function setViewDirectory($viewDir)
 {
     $this->template->setDirectory($viewDir);
 }