Download the PHP package netcore/module-content without Composer
On this page you can find all versions of the php package netcore/module-content. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package module-content
Content management with widgets v2.1
Idea behind this package is that many webpages are constructed from different sections, that look different in frontend, but they can use identical UI and database structure in backend. For example, a typical landing page might consist from following sections:
- Large slider with images. Each image has large title and smaller subtitle.
- A grid of services provided by webpage. Each item in grid has image, title and subtitle.
- Testimonials. Each item has image, person's name, and content.
- Brands. Each item has image and link to external website.
- Employees. Each item has image, name, position, age and link to Linkedin.
We call these sections "widgets". Each of these look very different in frontend, but backend can be made universal. That's because we typically need the same fields over and over again - image, title, subtitle, content. Any not so common fields, like links, buttons or other non-standard information is stored in a JSON format.
In order to add a new widget to your page, you would perform only the following actions:
- Seed new widget in database
- Create custom frontend template file for that widget
And that's it! Backend will be generated automatically. You can reorder, edit, and add new widgets to pages. Screenshot:
Pre-installation
This package is part of Netcore CMS ecosystem and is only functional in a project that has following packages installed:
- https://github.com/netcore/netcore
- https://github.com/netcore/module-admin
- https://github.com/netcore/module-translate
Installation
Require this package with composer:
composer require netcore/module-content:2.1.*
Publish config, assets, migrations. Migrate and seed:
php artisan module:publish-config Content
php artisan module:publish Content
php artisan module:publish-migration Content
php artisan migrate
php artisan module:seed Content
Package also comes with basic ResolverController.php and routes for showing static pages and channels. It will work for many simple pages. If you need something more sophisticated or custom, you will need to implement your own Resolver. However, in most cases add this to your RouteServiceProvider.php (typically in method:
Route::group([
'middleware' => ['web'],
'namespace' => null,
], function (Router $router) {
\Modules\Content\Http\ResolverRouter::register($router);
});
After installation, you should config file.
Updating to new version
Let's imagine you have installed version v2.1.0, but a couple of days later v2.1.1 is released. Because we are working with https://github.com/nWidart/laravel-modules, simply doing might not be enough, because there might be changes in assets and/or migrations. Therefore, to install new version, you should run all the following commands:
composer update netcore/module-content
php artisan module:publish Content
php artisan module:publish-migration Content
php artisan migrate
Terminology
Before working with this package, it can be helpful to understand basic terminology:
- Entry - this is a page. It can be either a standalone page like "Terms and services", or it can belong to a channel. For example - page "Post 1" in "Blog" channel.
- Channel - this is a group of entries. Common examples of channels are "Blog", "News", "Reports".
- Section - sections are currently not used anywhere and will be deleted in version 0.1.x
- Widget - some sort of section that exists in page. Common examples are LargeSliderWidget, TestimonialsWidget, EmployeesWidget.
It is better to keep everything in separated seed files, because it can get messy after some time. We recommend to create WidgetSeeder, ChannelSeeder, PageSeeder
Adding a new widget
- Start with widget seeding
Widget fields are meant for widget main information. For example, title. Item fields are meant for items which will be stored in widget. You can store multiple items in one widget. You can customize widget options, available options:
You can create empty widget, which won't be configurable from Content section in admin panel, but you can display any data in frontend template. This is useful if you want to display forum thread list. Here is an example widget:
- In most cases you will want to customize name, key, frontend_template, javascript_key, backend_worker and fields. However, in most cases your will not customize backend_template and backend_worker. These are usually universal.
- Create template that you specified as in step one.
- All done. Backend is generated automatically.
Creating pages and seeding widget content
You can seed multiple pages per channel. By default there is always default channel (Main) which contains static pages, but there is cases where you would want to create another channel for News.
Below there is an example for seeding pages per channel
$homepageData looks like
Adding a new channel
If you want to create new channels, for example, you may want to create news channel where you would store news articles.
However, you need to configure and create a template for each of your channels in
Template file looks like this
Main information about versions
0.1 branch contains initial version of package. It has very limited multi-language support and it is mainly intended for use in not-translatable websites.
1.0 properly supports translatable websites. SimpleText and ImageBlocks widgets are deleted in favor of more universal WidgetBlock widget. Additionally, fields for widget items are no longer stored as JSON.
2.0 TODO
All versions of module-content with dependencies
dimsav/laravel-translatable Version ^9.0
yajra/laravel-datatables-oracle Version ~8.0
intervention/image Version ~2.4
codesleeve/laravel-stapler Version ^1.0