PHPackages                             almeyda/yii2-simple-pages - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. almeyda/yii2-simple-pages

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

almeyda/yii2-simple-pages
=========================

basic yii2 extension to create sites with simple set of pages

08PHP

Since Dec 6Pushed 5y ago2 watchersCompare

[ Source](https://github.com/willarin/yii2-simple-pages)[ Packagist](https://packagist.org/packages/almeyda/yii2-simple-pages)[ RSS](/packages/almeyda-yii2-simple-pages/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Simple Pages Module
===================

[](#simple-pages-module)

Simple Pages Module is a simple client-side CMS module for Yii2.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Place **composer.phar** file in the same directory with **composer.json** file and run

```
$ php composer.phar require almeyda/yii2-simple-pages "*"

```

or add

```
{
    ...
    "require": {
        ...
        "almeyda/yii2-simple-pages": "*"
        ...
    }
    ...
}

```

to the *"require"* section of your `composer.json` file and run

```
$ php composer.phar update

```

Configuration
-------------

[](#configuration)

Once the extension is installed, modify your application configuration to include:

```
return [
    ...
    'modules' => [
        ...
        'pages' => [
           'class' => 'almeyda\pages\Module',
        ],
        ...
    ],
    ...
    'components' => [
        ...
        'urlManager' => [
            'class' => 'codemix\localeurls\UrlManager',
            'rules' => [
                ...
                ...
                ...
                'pages' =>  [
                        'pattern' => 'blog/',
                        'route' => 'pages/page/page',
                        'defaults' => ['view' => 'index'],
                        'suffix' => '.html'
                ],
                ...
            ]
        ...
        ],
        'view' => [
            ...
            'theme' => [
                'pathMap' => [
                    '@app/views/layouts' => '@app/views/themes/{your-theme}/layouts',
                    '@almeyda/pages/views/page/pages/blog' => '@app/views/themes/{your-theme}/pages',
                    ...
            ],
            ...
        ],
    ],
    ...
]
];
```

Usage example
-------------

[](#usage-example)

We build a very simple blog with common layout, list of posts at the index.php page and articles (like post1.php, post2.php, ...) We use example with 'blog' based on Yii2 path map feature. Please note that rule 'pages' should be added at the end of the rules stack. Otherwise all simple requests will be processed by the 'pages' module.

\###Structure of the folders:

```
views/                          (folder) basic yii2 project views folder
    └─themes/                   (folder) folder with the list of themes
        └─{your-theme}/         (folder) your theme
            ├─layout/           (folder) layouts used for blog
            │   └main.php       (file) layout html/php
            └─pages/            (folder) views used for blog
                ├─ index.php    (file) file with the list of posts
                ├─ post1.php    (file) file with some content of the 1st post
                └─ post2.php    (file) file with some content of the 2nd post

```

### File examples

[](#file-examples)

**\[main.php\]**

layout used

```
