2017 © Pedro Peláez
 

yii2-extension yii2-blog

Yii2 Blog for other application

image

funson86/yii2-blog

Yii2 Blog for other application

  • Friday, August 7, 2015
  • by funson86
  • Repository
  • 6 Watchers
  • 21 Stars
  • 1,571 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 21 Forks
  • 4 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

Yii2 Blog

Yii2 Blog for other application, especially for Yii2 Adminlte, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist funson86/yii2-blog "dev-master"

or add, (*4)

"funson86/yii2-blog": "*"

to the require section of your composer.json file., (*5)

Migration

Migration run, (*6)

yii migrate --migrationPath=@funson86/blog/migrations

Config url rewrite in /common/config/main.php

    'timeZone' => 'Asia/Shanghai', //time zone affect the formatter datetime format
    'components' => [
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
                '<controller:\w+>/<id:\d+>' => '<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
            ],
        ],
        'formatter' => [ //for the showing of date datetime
            'dateFormat' => 'yyyy-MM-dd',
            'datetimeFormat' => 'yyyy-MM-dd HH:mm:ss',
            'decimalSeparator' => ',',
            'thousandSeparator' => ' ',
            'currencyCode' => 'CNY',
        ],
    ],

Config backend modules in backend/config/main.php

    'modules' => [
        'blog' => [
            'class' => 'funson86\blog\Module',
            'controllerNamespace' => 'funson86\blog\controllers\backend'
        ],
    ],

Config frontend modules in frontend/config/main.php

    'defaultRoute' => 'blog', //set blog as default route
    'modules' => [
        'blog' => [
            'class' => 'funson86\blog\Module',
            'controllerNamespace' => 'funson86\blog\controllers\frontend'
        ],
    ],

Add yii2-blog params in /common/config/params.php.

return [
    'blogTitle' => 'HikeBlog',
    'blogTitleSeo' => 'Simple Blog based on Yii2',
    'blogFooter' => 'Copyright &copy; ' . date('Y') . ' by ahuasheng on Yii2. All Rights Reserved.',
    'blogPostPageCount' => '10',
    'blogLinks' => [
        'Google' => 'http://www.google.com',
        'Funson86 Blog' => 'http://github.com/funson86/yii2-blog',
    ],
    'blogUploadPath' => 'upload/', //default to frontend/web/upload
];

Access Url

  1. backend : http://you-domain/backend/web/blog
    • Catalog : http://you-domain/backend/web/blog/blog-catalog
    • Post : http://you-domain/backend/web/blog/blog-post
    • Comment : http://you-domain/backend/web/blog/blog-comment
    • Tag : http://you-domain/backend/web/blog/blog-tag
  2. frontend : http://you-domain/fontend/web/blog

The Versions

07/08 2015

dev-master

9999999-dev

Yii2 Blog for other application

  Sources   Download

Apache-2.0

The Requires

 

by Funson Lee

extension yii2