PHP Classes

How to Provide a PHP Website Builder that Lets Users Manage Website Pages using the Package Yii2 Website Module: Add a content page management system to a site

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-07-24 (8 months ago) RSS 2.0 feedNot enough user ratingsTotal: 12 All time: 11,474 This week: 51Up
Version License PHP version Categories
yii2-website-module 1.0BSD License5PHP 5, Libraries, Content management
Description 

Author

This package can add a content page management system to a site.

It provides a Web application that can be added to a site to manage and publish pages to a site.

The package provides a backend that allows users to manage pages with navigation menus.

It also provides a frontend that can publish the managed pages.

Picture of Gabriel Alejandro López López
  Performance   Level  
Innovation award
Innovation award
Nominee: 3x

 

Documentation

Yii2 Website Module

Latest Stable Version Total Downloads Latest Unstable Version License

Yii2 module to implement a website.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist daxslab/yii2-website-module "*"

or add

"daxslab/yii2-website-module": "*"

to the require section of your composer.json file.

Introduction

Website tries to be an unobstrusive CMS without limiting the capabilities of Yii2 framework as development platform. The idea is that you can add website features to an existing application, or just create a website based on Yii2 framework.

The idea behind Website module is a bit different compared with other CMS. While generally pages, posts and categories are managed, in Website everything is a page and every page can have children pages so,

  • a page without subpages can be considered a regular _page_
  • a page with subpages can be considered a _category_
  • a subpage can be considered a _post_

The resulting tree can then have wathever depth is required.

Besides pages, Website also manages Media: any attached file that can be referenced in the resulting website. The module handles the uploading process.

Also you can manage Menus with Website module. For every menu you can create menu items and this than be pointed to any URL. When creating a menu item you either type the label and URL, or select from existing pages.

Configuration

Website is meant to be used with the Yii2 Advanced Application template. Some modification could be done to make it usable with basic template.

Module

First configure the module for all the apps in common/config/main.php

//...
'modules' => [
	'website' => [
		'class' => daxslab\website\Module::class,
		'languages' => ['en', 'es', 'it'],
		'token' => 'some-string-here'
	]
]
//...

Here notice the specified attributes: - languages: array with the languages that will be active for creating content - token: string identifying every website in case that several are used.

Database

It is assumed that you are using some database and that the connection to it it's already set. Configure migrations in console/config/main.php

//...
'controllerMap' => [
    'migrate' => [
        'class' => 'yii\console\controllers\MigrateController',
        'migrationNamespaces' => [
            'daxslab\website\migrations',
        ]
    ],
],
//...

Controllers

Configure controllers namespaces for the module in each app. Let's start with frontend/config/main.php

//...
'modules' => [
	'website' => [
		'controllerNamespace' => 'daxslab\website\controllers\frontend'
	]
]
//...

And similar for backend/config/main.php

//...
'modules' => [
	'website' => [
		'controllerNamespace' => 'daxslab\website\controllers\backend'
	]

]
//...

Usage

The module provides two sets of controllers: frontend and backend.


  Files folder image Files (121)  
File Role Description
Files folder imageassets (2 directories)
Files folder imagebehaviors (1 file)
Files folder imagecommands (1 file)
Files folder imagecomponents (1 file)
Files folder imagecontrollers (2 directories)
Files folder imagemessages (1 file, 1 directory)
Files folder imagemigrations (12 files)
Files folder imagemodels (25 files)
Files folder imageviews (2 directories)
Files folder imagewidgets (1 file)
Plain text file Bootstrap.php Class Class source
Accessible without login Plain text file composer.json Data Auxiliary data
Plain text file Module.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation
Plain text file WebsiteAsset.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:12
This week:0
All time:11,474
This week:51Up