shoxabbos/yii2-localpages
Composer 安装命令:
composer require shoxabbos/yii2-localpages
包简介
Create local pages
README 文档
README
Create multi language static pages
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist shoxabbos/yii2-localpages "*"
or add
"shoxabbos/yii2-localpages": "*"
to the require section of your composer.json file.
Usage
Once the extension is installed, simply use it in your code by :
Run migrate
php yii migrate --migrationPath=@vendor/shoxabbos/yii2-localpages/migrations
Add module to web/config
'modules' => [ 'pages' => [ 'class' => '\shoxabbos\localpages\Module', 'langs' => [ 'ru' => 'Russian', 'en' => 'English', ], 'defaultRoute' => 'page', 'defaultLang' => 'ru', 'layoutPath' => '@app/path/to/layouts', 'layout' => 'admin', 'pagesTableName' => 'pages', 'pagesContentTableName' => 'page_contents', ], ]
Add action to your controller (viewFile: your view file for showing pages)
public function actions() { return [ 'page' => [ 'class' => 'shoxabbos\localpages\actions\ViewAction', 'viewFile' => 'page' ], ]; }
For add news: http://localhost:8080/pages/page/create
For see created your post: http://localhost:8080/site/page?slug=test
If you want a nice url you can set up the URL manager:
'page/<slug:\w+>' => 'site/page'
After that, you can open the pages as:
统计信息
- 总下载量: 37
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-08-13