本文整理汇总了PHP中League\Plates\Engine::setDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP Engine::setDirectory方法的具体用法?PHP Engine::setDirectory怎么用?PHP Engine::setDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类League\Plates\Engine
的用法示例。
在下文中一共展示了Engine::setDirectory方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addPath
/**
* 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: __construct
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: __construct
/**
* 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: __construct
/**
* 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: setViewDirectory
public function setViewDirectory($viewDir)
{
$this->template->setDirectory($viewDir);
}