Download the PHP package andrewdanilov/yii2-custom-pages without Composer

On this page you can find all versions of the php package andrewdanilov/yii2-custom-pages. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii2-custom-pages

Custom pages

Module contains backend and frontend parts. Placed to backend it gives you ability to create custom pages in cms-like way. Pages groups by categories, i.e. news, articles, etc. Placed to frontend module displays category (list of pages previews) and pages itself by their friendly urls. Pages and categories has own templates (Views), which you can define in page or category settings.

Installation

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json file.

Then run db migrations, to create needed tables:

Do not forget to run migrations after extension updates too.

Usage

In backend main config modules section add:

Here access option allows restricting access to defined roles.

Backend CRUD actions are available by links:

Backend menu items example:

In frontend main config modules section add:

Frontend page, category and tag urls:

Features

Out of the box available some usefull features.

Page cover

You can add some picture, represents your page. It is usefull in case of making blog posts, site news or articles.

Html visual editor

Embedded WYSIWYG-editor helps you easily make any visual content. It has ability to place images, videos and other usefull things in content of your pages or categories.

Human-friendly urls

You can define slugs for categories and pages. For nested categories and their pages, a link is consistently composed of slugs of hierarchically nested categories.

Main page

You can define a page as main page of the site. Then it repleces index action of default controller.

Publish date

Any date can be defined to pospone publication of page. If not set manually, the creation date will be set as publish date.

Shortcodes

You can use some predefined shortcodes in text content of created pages. To place gallery or slider inside page content, you can add theese shortcodes to page WYSIWYG-editor in admin area:

Before that, album and some photos needs to be added to page (press "Add album" and than "Add photo"). Albums has own buttons to copy their shortcodes to clipboard.

With extended syntax of shortcode you can add "alt" attribute to all pictures of gallery or slider. It can contain substitutions: {index}, {filename}, {basename}, {extension}.

SEO

There is ability to set seo-fields for any created page or category. You can define browser title and meta description.

Categories

Pages grouped by categories. You can add unlimited count of categories with unlimited count of pages inside each other. Categories can have unlimited nesting level. Besides, pages can exist without any categories at all.

Tags

Pages also can be grouped by tags. One tag can represent several pages. One page can contain many tags.

Templates

Each category can have own template for itself and separete template for pages stored in it. At the same time, pages can have their own template, even if it was set in the category settings. If page template is not set in page settings, page template of category settings will be applied to it. If page have no own template and have no category, the default template will be used.

If you use own templatesPath you need to copy example templates from /vendor/andrewdanilov/yii2-custom-pages/src/frontend/views to your templatesPath directory, for example to frontend/views/custompages. Modify them or add as many templates as you need.

Note, that template file name for a category must begin with the prefix 'category.', template file name for a page must begin with the prefix 'page.'. The default template names are 'category.default.php' for category and 'page.default.php' for page.

Template file name for a tag must begin with the prefix 'page-tag.'. A dot at the end of the prefix is required. Next to it you can place category slug to make standalone template for tag-page with defined category. For i.e. 'page-tag.fruits.php' for category with slug 'fruits'. If there is no such template file the default will be used. Default template file for page-tag is 'page-tag.default.php'.

Custom fields

For each category you can define extra fields applied to pages of that category. You can set values of this fields from backend within a page editor, and access them from your templates like this:

For this feature to work you must enable enablePageFields property of custompage module in backend config (see above). If requested field is not exist, then getField() returns empty string, hasField() and getFieldType() returns false

Since the 2.0.20 update, if you previously used the "source" page field, you need to replace it in your templates with the custom fields method. For example, if you called $page->source, now you need to call $page->getField('source'). Your data from old field was converted to custom fields automatically.

I18n

Extension supports internationalisation. You can set your language in common/config/main.php

On the moment you can use one of languages out of the box: English, Russian. Also you can create and use your own translations by defining translatesPath property of custompages module (see above). Therefore, you need to place the files xx-XX/category.php, xx-XX/page.php, xx-XX/page-tag.php, xx-XX/common.php in this path. You can copy them from src/common/messages path of extension.

Page and Category text processor

You can define static function, that will process and change page or category text content. See example with parameter pageTextProcessor and categoryTextProcessor in module config above. That function must accept one string parameter and return string with modifications made. In example, you can replace some shortcodes in text with that function. Function applies to the text when you get it via processedText property of Page or Category ActiveRecord object. Made changes are not storing to database.

Example of processor function:


All versions of yii2-custom-pages with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
ext-json Version *
yiisoft/yii2 Version ~2.0.0
mihaildev/yii2-elfinder Version *@dev
andrewdanilov/yii2-input-images Version ~1.0.2
andrewdanilov/yii2-grid-tools Version ~1.0.2
andrewdanilov/yii2-behaviors Version ~1.0.20
andrewdanilov/yii2-helpers Version ~1.0.15
andrewdanilov/yii2-fancybox Version ~1.0.0
andrewdanilov/yii2-swiper-slider Version ~1.0.0
andrewdanilov/yii2-ckeditor Version ~1.0.1
kartik-v/yii2-widget-select2 Version @dev
kartik-v/yii2-widget-datepicker Version @dev
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package andrewdanilov/yii2-custom-pages contains the following files

Loading the files please wait ....