uniqby/yii2-smart-layout 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

uniqby/yii2-smart-layout

最新稳定版本:0.3

Composer 安装命令:

composer require uniqby/yii2-smart-layout

包简介

Smart Layout behavior for Yii framework 2.

README 文档

README

Yii2 Smart Layout behavior makes the theming of your application so simple

Installation

Composer

The preferred way to install this extension is through Composer.

Either run

php composer.phar require uniqby/yii2-smart-layout "dev-master"

or add

"uniqby/yii2-smart-layout": "dev-master"

to the require section of your composer.json

Usage

Configure Smart Layout behavior in common config:

'view' => [
	'as smartLayout' => [
    	'class' => \uniqby\smartLayout\Behavior::className(),
	]
]

Info

Component searches for the layout file relative to the current theme, module, controller and action.

$pathMaps = $controller->view->theme->pathMap;
if (is_array($pathMaps) && !empty($pathMaps)) {
	foreach ($pathMaps as $path) {
		if ($moduleId !== null) {
			$layouts[] = "{$path}/{$moduleId}/layouts/{$controllerId}_{$actionId}";
			$layouts[] = "{$path}/{$moduleId}/layouts/{$controllerId}";
			$layouts[] = "{$path}/{$moduleId}/layouts/main";
		} else {
			$layouts[] = "{$path}/layouts/{$controllerId}_{$actionId}";
			$layouts[] = "{$path}/layouts/{$controllerId}";
			$layouts[] = "{$path}/layouts/main";
		}
	}
}

Author

Alexander Sazanovich, e-mail: alexander@uniq.by

统计信息

  • 总下载量: 269
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2014-11-23