本文整理汇总了PHP中yii\web\Controller::getViewPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::getViewPath方法的具体用法?PHP Controller::getViewPath怎么用?PHP Controller::getViewPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\web\Controller
的用法示例。
在下文中一共展示了Controller::getViewPath方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getViewPath
/**
* Override the default Yii controller getViewPath method. To define the template folders in where
* the templates are located. Why? Basically some modules needs to put theyr templates inside of the client
* repository.
*
* @return string
*/
public function getViewPath()
{
if ($this->module instanceof Module && $this->module->useAppViewPath) {
return '@app/views/' . $this->module->id . '/' . $this->id;
}
return parent::getViewPath();
}
示例2: getViewPath
public function getViewPath()
{
$module = $this->module->id;
if ($module === Yii::$app->id) {
return parent::getViewPath();
}
return Yii::getAlias('@app') . '/views/' . $module . '/' . $this->id;
}
示例3: getViewPath
public function getViewPath()
{
if (!isset($this->viewPathOverride)) {
return parent::getViewPath();
} else {
return $this->viewPathOverride . DIRECTORY_SEPARATOR . $this->id;
}
}
示例4: getViewPath
/**
* Override the default Yii controller getViewPath method. To define the template folders in where
* the templates are located. Why? Basically some modules needs to put theyr templates inside of the client
* repository.
*
* @return string
*/
public function getViewPath()
{
// if the module settings is turn to use the module view path we use them always first!
if ($this->module->controllerUseModuleViewPath !== null) {
$this->useModuleViewPath = $this->module->controllerUseModuleViewPath;
}
// use default yii behaviour
if ($this->useModuleViewPath) {
return parent::getViewPath();
}
// use client repository specific path
return '@app/views/' . $this->module->id . '/' . $this->id;
}
示例5: render
public function render($view, $params = [])
{
$devicedetect = \Yii::$app->devicedetect;
$isMobile = $devicedetect->isMobile();
$isTablet = $devicedetect->isTablet();
$mobileTpl = $isMobile && !$isTablet;
// detect and change layout
if ($mobileTpl) {
$this->layout = '@app/views/layouts/sp_main';
}
// detect and render view
$detectView = $view . ($mobileTpl ? '_sp' : '');
$detectPath = parent::getViewPath() . "/{$detectView}.php";
return parent::render(file_exists($detectPath) ? $detectView : $view, $params);
}
示例6: getViewPath
/**
* Get view path based on module property
*
* @return string
*/
public function getViewPath()
{
return Yii::$app->getModule('user')->viewPath ? rtrim(Yii::$app->getModule('user')->viewPath, '/\\') . DIRECTORY_SEPARATOR . $this->id : parent::getViewPath();
}
示例7: getViewPath
/**
* Get view path based on module property
* @return string
*/
public function getViewPath()
{
return Yii::$app->getModule("golfteamplanner")->viewPath ? rtrim(Yii::$app->getModule("golfteamplanner")->viewPath, "/\\") . DIRECTORY_SEPARATOR . $this->id : parent::getViewPath();
}
示例8: getViewPath
public function getViewPath()
{
if ($this->getCart()->module->viewPath) {
return Yii::getAlias($this->getCart()->module->viewPath . DIRECTORY_SEPARATOR . 'cart');
}
return parent::getViewPath();
}