Yii2 E-Sculptor

Yii2 E-Sculptor

SKU : Yii2_E-Sculptor-EN
$35.00
Qty

Features

  • CRUD for pages, categories and posts
  • Menu management
  • Multimedia management
  • Integrated with TinyMCE for a Wysiwyg edition
  • It allows multilanguage content

This module is integrated with yii2-storage, a Yii2 component that manages the local storage or the cloud storage.


 Instalation

Download the compressed file and unzip it in the vendor/neoacevedo directory. You may need to manually install the dependencies and also configure the namespaces of the extensions in your Yii2 extension configurations manually.

Migrations
  • First run the Yii2-menu migration:
php yii migrate [email protected]/pceuropa/migrations/
  • Then execute the CMS migration:
php yii migrate [email protected]/neoacevedo/cms/migrations/

Module Settings

The following configurations are optional. If no value is established for them, the predefined values ​​in the module will be taken. To set different configurations (advanced template only), you must first add the module configuration in backend/config/main.php and frontend/config/main.php.

  • postLayout: path to the layout for publications.
  • pageLayout: path to the layout for the pages.
  • categoryLayout: path to the layout for the categories.
  • searchLayout: path to the layout for the search results.
  • postViewPath: path for views of publications.
  • pageViewPath: path for page views.
  • categoryViewPath: path for the views of the categories.
  • searchViewPath: path for the views of the search results.
  • pageSize: number of results per page.
  • userClass: class of the user model of the application. Predefined to \common\models\User::class.
  • displayLangCodeInUrl : defines whether the language is added to the URL. Example:  http://dominio/es/pagina.

Usage

The configuration can be for the entire project (regardless of whether you are using the basic template or the advanced Yii2 template).

For the whole project, add the following configuration in the common/config/main.php file of your project (or in config/main.php if you use the basic template)

...
'modules' => [
...
    'cms' => [
        'class' => neoacevedo\cms\Module::class
    ]
]

This will allow the administration and visualization of the content.

URL Manager

Configure the urlManager rules as follows:

...
'urlManager' => [
    'class' => 'neoacevedo\cms\components\ContentUrlManager',
    'enablePrettyUrl' => true,
    'showScriptName' => false,
    'rules' => [
        [
            'class' => 'yii\web\UrlRule',
            'pattern' => 'search/view',
            'route' => '/cms/search/view'
        ]
    ],
    'cmsUrlRules' => [
        'cms/<controller:(page|post)>/<action:view>' => '<alias>',
        'cms/<controller:(post|category)>/<action:view>' => '<category-alias>/<alias>',
    ]
],
...
Menu

In addition to this, the module includes the pceuropa/yii2-menu module. To use it, add the following configuration to the main.php file of your project (config/main.php for the basic template, backend/config/main.php for the advanced template):

'menu' => [
    'class' => '\pceuropa\menu\Menu',
],

When executing the migration, a default menu called "Main menu" is created.

In the layout of your public site, include the module: use pceuropa\menu\Menu; and in the items option of the Nav widget replace the predefined items and add Menu::NavbarLeft ("Main menu");

Storage

Yii2 E-Sculptor uses neoacevedo\yii2-storage for the storage of images.

To use it, add the following configuration inside the module to the main.php file of your project(config/main.php for the basic template, backend/config/main.php for the advanced template):

<?php
...
    'modules' => [
        ...
        'cms' => [
            'class' => neoacevedo\cms\Module::class,
            'components' => [
                /**
                 * Amazon S3
                 */
//                'storage' => [
//                    'class' => 'neoacevedo\yii2\Storage',
//                    'service' => 's3',
//                    'config' => [
//                        'key' => 'YOUR_IAM_ACCESS_KEY',
//                        'secret' => 'YOUR_IAM__SECRET_ACCESS_KEY',
//                        'bucket' => 'your-bucket',
//                        'region' => 'your-region',
//                        'extensions' => 'pdf, jpg, jpeg, gif, png, bmp'
//                    ],
//                    'prefix' => '', // ruta al directorio de imágenes. Ej: images/ (Opcional)
//                ],
                /**
                 * Azure Storage Blob
                 */
//                'storage' => [
//                    'class' => 'neoacevedo\yii2\Storage',
//                    'service' => 'azure',
//                    'config' => [
//                        'accountName' => 'ACCOUNT_NAME',
//                        'accountKey' => 'ACCOUNT_KEY',
//                        'container' => 'your-container',
//                        'extensions' => 'pdf, jpg, jpeg, gif, png, bmp'
//                    ],
//                    'prefix' => '' // ruta al directorio de imágenes. Ej: images/ (Opcional)
//                ],
                /**
                 * Google Storage Cloud
                 */
//                'storage' => [
//                    'class' => 'neoacevedo\yii2\Storage',
//                    'service' => 'gsc',
//                    'config' => [
//                        'projectId' => 'YOUR_PROJECT_ID',
//                        'bucket' => 'your-bucket',
//                        'keyFile' => '', // Contenido del archivo JSON generado en la consola de Google
//                        'extensions' => 'pdf, jpg, jpeg, gif, png, bmp'
//                    ],
//                    'prefix' => '', // ruta al directorio de imágenes. Ej: images/ (Opcional)
//                ],
                /**
                 * Almacenamiento local
                 */
//                'storage' => [
//                    'class' => 'neoacevedo\yii2\Storage',
//                    'service' => 'local',
//                    'config' => [
//                        'baseUrl' => "//" . filter_input(INPUT_SERVER, "SERVER_NAME"), // ej: http://example.com/
//                        'directory' => '@webroot/web/', // reemplace @webroot por @frontend o @backend según sea el caso. Debe terminar con una barra diagonal.
//                        'extensions' => 'pdf, jpg, jpeg, gif, png, bmp'
//                    ],
//                    'prefix' => '', // ruta al directorio de imágenes. Ej: images/ (Opcional)
//                ]
            ]
        ],
        ...
    ],
...

You can only have one storage service. Uncomment what you require and configure it according to your needs.


Widget (optional)

To display a list of publications of a category in the public environment, simply use the following code:

<?= \neoacevedo\cms\widgets\PostWidget::widget([
    'category' => 'mi-categoria',
    'pagination' => [
        'pageSize' => 10
]]); ?>

It also has a widget that renders a small search box:

<?= \neoacevedo\cms\widgets\SearchForm::widget([
        'options' => [
            'class' => 'col-md-3'
        ] // options permite renderizar atributos HTML
]); ?>

PHP Requirements

cURL
PHP JSON
PHP Version: 7

Yii2 Requirements

yiisoft/yii2-jui
kartik-v/yii2-widget-sidenav
paulzi/yii2-nested-intervals
2amigos/yii2-tinymce-widget
rmrevin/yii2-fontawesome
pceuropa/yii2-menu
neoacevedo/yii2-storage