2017 © Pedro Peláez
 

yii2-extension yii2-articles

Yii2 Articles to create, manage, and delete articles in a Yii2 site.

image

cinghie/yii2-articles

Yii2 Articles to create, manage, and delete articles in a Yii2 site.

  • Wednesday, July 25, 2018
  • by cinghie
  • Repository
  • 9 Watchers
  • 31 Stars
  • 1,609 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 21 Forks
  • 3 Open issues
  • 14 Versions
  • 13 % Grown

The README.md

Yii2 Articles

License Latest Stable Version Latest Release Date Latest Commit Total Downloads, (*1)

Yii2 Articles to create, manage, and delete articles in a Yii2 site., (*2)

  • Create, edit and delete articles
  • Article with attachments, image, gallery, hits
  • Manage categories and subcategories
  • Advanced Access Permission
  • Approval
  • Multi-Language with I18N
  • Extra Field Management
  • SEO Optimization

Installation

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

Either run, (*4)

$ php composer.phar require cinghie/yii2-articles "*"

or add, (*5)

"cinghie/yii2-articles": "*"

Configuration

1. Images folder

Copy img folder to your webroot, (*6)

2. Update yii2 articles database schema

Make sure that you have properly configured db application component.
Make sure that you have an user with id=1.
Run the following command:, (*7)

$ php yii migrate/up --migrationPath=@vendor/cinghie/yii2-articles/migrations

3. Set configuration file

Set on your configuration file, in modules section, (*8)

'modules' => [ 

    // Module Articles
    'articles' => [
        'class' => 'cinghie\articles\Articles',
        'userClass' => 'dektrium\user\models\User',

        // Select Languages allowed
        'languages' => [ 
            "it-IT" => "it-IT", 
            "en-GB" => "en-GB" 
        ],          
        // Select Default Language  
        'languageAll' => 'it-IT',

        // Select Date Format
        'dateFormat' => 'd F Y',

        // Select Editor: no-editor, ckeditor, imperavi, markdown, tinymce
        'editor' => 'ckeditor',

        // Select Path To Upload Category Image
        'categoryImagePath' => '@webroot/img/articles/categories/',
        // Select URL To Upload Category Image
        'categoryImageURL'  => '@web/img/articles/categories/',
        // Select Path To Upload Category Thumb
        'categoryThumbPath' => '@webroot/img/articles/categories/thumb/',
        // Select URL To Upload Category Image
        'categoryThumbURL'  => '@web/img/articles/categories/thumb/',

        // Select Path To Upload Item Image
        'itemImagePath' => '@webroot/img/articles/items/',
        // Select URL To Upload Item Image
        'itemImageURL' => '@web/img/articles/items/',
        // Select Path To Upload Item Thumb
        'itemThumbPath' => '@webroot/img/articles/items/thumb/',
        // Select URL To Upload Item Thumb
        'itemThumbURL' => '@web/img/articles/items/thumb/',

        // Select Path To Upload Attachments
        'attachPath' => '@webroot/attachments/',
        // Select URL To Upload Attachment
        'attachURL' => '@web/img/articles/items/',
        // Select Image Types allowed
        'attachType' => ['jpg','jpeg','gif','png','csv','pdf','txt','doc','docs'],

        // Select Image Name: categoryname, original, casual
        'imageNameType' => 'categoryname',
        // Select Image Types allowed
        'imageType' => ['png','jpg','jpeg'],
        // Thumbnails Options
        'thumbOptions'  => [ 
            'small'  => ['quality' => 100, 'width' => 150, 'height' => 100],
            'medium' => ['quality' => 100, 'width' => 200, 'height' => 150],
            'large'  => ['quality' => 100, 'width' => 300, 'height' => 250],
            'extra'  => ['quality' => 100, 'width' => 400, 'height' => 350],
        ],

        // Slugify Options
        $slugifyOptions = [
            'separator' => '-',
            'lowercase' => true,
            'trim' => true,
            'rulesets'  => [
                'default'
            ]
        ],

        // Show Titles in the views
        'showTitles' => true,
        ],  
    ],

]

4. Other Configurations

To use easily this extension is strongly recommended install and config dektrium/yii2-user to manage user, (*9)

Installation
Configuration, (*10)

and dektrium/yii2-rbac to manage auth permission, (*11)

Installation, (*12)

5. Add your User as admin

INSERT INTO `PREFIX_auth_assignment` (`item_name`, `user_id`, `created_at`) VALUES
('admin', 'YUOR_USER_ID', 1451514052);

Override PREFIX_ with your tables prefix and YUOR_USER_ID with your user_id. For example:, (*13)

INSERT INTO `auth_assignment` (`item_name`, `user_id`, `created_at`) VALUES
('admin', '1', 1451514052);

Advanced Template recommended configuration, (*14)

URL Rules

'components' => [

    // Url Manager
    'urlManager' => [
    'class' => 'codemix\localeurls\UrlManager',
    // All languages including the default language
    'languages' => ['it', 'en'],
    // The default language is now treated like any other configured language
    'enableDefaultLanguageUrlCode' => true,
        // Disable index.php
        'showScriptName' => false,
        // Disable r= routes
        'enablePrettyUrl' => true,
        // Disable site/ from the URL
        'rules' => [
            '<alias:index|about|contact>' => 'site/<alias>',
        '<id:\d+>/<alias:[A-Za-z0-9 -_.]+>' => 'articles/categories/view',
        '<cat>/<id:\d+>/<alias:[A-Za-z0-9 -_.]+>' => 'articles/items/view',
        '<tags>/<id:\d+>/<alias:[A-Za-z0-9 -_.]+>' => 'articles/tags/view'
        ],
     ],

],

Filters

If you have a Yii2 App Advanced (frontend/backend) you can exclude frontend actions, (*15)

'modules' => [ 

    'articles' => [ 
        'class' => 'cinghie\articles\Articles',
        'as frontend' => 'cinghie\articles\filters\FrontendFilter',
    ]

],

Overrides

Override controller example, on modules config, (*16)

'modules' => [ 

    'articles' => [ 
        'class' => 'cinghie\articles\Articles',
        'controllerMap' => [
            'items' => 'app\controllers\MyItemsController'
        ]
    ]

],

Override models example, on modules config, (*17)

'modules' => [ 

    'articles' => [ 
        'class' => 'cinghie\articles\Articles',
        'modelMap' => [
            'Items' => 'app\models\MyItemsModel'
        ]
    ]

],

Override view example, on components config, (*18)

'components' => [ 

    'view' => [
        'theme' => [
            'pathMap' => [
                '@cinghie/articles/views/items' => '@app/views/articles/items',
            ],
        ],
    ],

],

Override examples can be found on overrides folder, (*19)

Users Auth

Articles Permissions

create publish update delete index view
admin yes all all all yes yes
editor yes all all his yes yes
publisher yes his his no his yes
author yes no his no his yes

Categories Permissions

create publish update delete index view
admin yes yes yes yes yes yes
editor yes no yes no yes yes
publisher no no no no yes yes
author no no no no yes yes

Tags Permissions

create publish update index delete
admin yes yes yes yes yes
editor yes yes yes yes yes
publisher yes yes yes yes no
author yes no no no no

Users Types

The migrations add to the database 4 types of users:, (*20)

  1. Admin:
    • Can Create Categories
    • Can Publish Categories
    • Can Delete Categories
    • Can Update Categories
    • Can Index Categories
    • Can Create Articles
    • Can Publish all Articles
    • Can Update all Articles
    • Can Delete all Articles
    • Can Index all Articles
    • Can View all Articles
    • Can Create Tags
    • Can Publish Tags
    • Can Delete Tags
    • Can Update Tags
    • Can Index Tags
  2. Editor:
    • Can Create Categories
    • Can't Publish Categories
    • Can't Delete Categories
    • Can Update Categories
    • Can Index Categories
    • Can Create Articles
    • Can Publish his Articles
    • Can Update all Articles
    • Can Delete his Articles
    • Can Index Articles
    • Can View all Articles
    • Can Create Tags
    • Can Publish Tags
    • Can Delete Tags
    • Can Update Tags
    • Can Index Tags
  3. Publisher:
    • Can't Create Categories
    • Can't Publish Categories
    • Can't Delete Categories
    • Can't Update Categories
    • Can Index Categories
    • Can Create Articles
    • Can Publish his Articles
    • Can Update his Articles
    • Can Delete his Articles
    • Can Index his Articles
    • Can View all Articles
    • Can Create Tags
    • Can Publish Tags
    • Can Update Tags
    • Can Index Tags
  4. Author:
    • Can't Create Categories
    • Can't Publish Categories
    • Can't Delete Categories
    • Can't Update Categories
    • Can Index Categories
    • Can Create Articles
    • Can't Publish his Articles
    • Can Update his Articles
    • Can't Delete Articles
    • Can't Index Articles
    • Can View Articles
    • Can Create Tags
  • Admin Panel: PathToApp/index.php?r=articles
  • Admin Panel with Pretty Urls: PathToApp/articles
  • Categories: PathToApp/index.php?r=articles/categories
  • Categories with Pretty Urls: PathToApp/articles/categories
  • Items: PathToApp/index.php?r=articles/items
  • Items with Pretty Urls: PathToApp/articles/items
  • Attachments: PathToApp/index.php?r=articles/attachments
  • Attachments with Pretty Urls: PathToApp/articles/attachments
  • Tags: PathToApp/index.php?r=articles/tags
  • Tags with Pretty Urls: PathToApp/articles/tags

The Versions

25/07 2018

dev-master

9999999-dev https://github.com/cinghie/yii2-articles

Yii2 Articles to create, manage, and delete articles in a Yii2 site.

  Sources   Download

BSD-3-Clause BSD 3-Clause

The Requires

 

yii2 module seo articles category contents yii2 blog yii2 articles yii2 contents yii2 category yii2 attachments yii2 tag

01/03 2018

dev-yii2-comunicati

dev-yii2-comunicati https://github.com/cinghie/yii2-articles

Yii2 Articles to create, manage, and delete articles in a Yii2 site.

  Sources   Download

BSD-3-Clause BSD 3-Clause

The Requires

 

yii2 module seo articles category contents

08/12 2017

v0.6.5

0.6.5.0 https://github.com/cinghie/yii2-articles

Yii2 Articles to create, manage, and delete articles in a Yii2 site.

  Sources   Download

BSD 3-Clause

The Requires

 

yii2 module seo articles category contents

13/11 2017

v0.6.4

0.6.4.0 https://github.com/cinghie/yii2-articles

Yii2 Articles to create, manage, and delete articles in a Yii2 site.

  Sources   Download

BSD 3-Clause

The Requires

 

yii2 module seo articles category contents