Download the PHP package ugie-cake/cakephp-content-blocks without Composer

On this page you can find all versions of the php package ugie-cake/cakephp-content-blocks. 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 cakephp-content-blocks

ContentBlocks plugin for CakePHP

About

Make previously-static parts of your website dynamic. Allow administrators and end users to edit blocks of content on the website without having to edit template files.

The left and right screenshots below show the same view + layout, but the administrator was able to modify the logo, title, main content, and footer text. All this with only a few lines of code in the CakePHP application:

And here is the administration interface for viewing and editing content blocks:

Usage

Install plugin via composer

Install this plugin into your CakePHP application using composer.

Load the plugin

You can either use the cake CLI:

or manualy add the following line to the bootstrap() function of your src/Application.php file:

Load the View Helper

Add the following line to the initialize() function of your src/View/AppView.php file:

Create the content_blocks table in your database

NOTE: This must be done for each environment you deploy your website to (localhost, dev, prod, etc). It also requires you to have setup your app.php or app_local.php file with an appropriate Datasources block to connect to the database.

Define content blocks

Prior to showing content in your templates, you must first define what blocks are available. This is done by inserting records into the content_blocks table, which is most easily done via Seeds.

Here is an example seed to create one content block of each type (html, text, and image):

Insert defined content blocks into database

Once you have defined your content blocks in a seed (see above), then you can run the "Seed" to create the records in the database:

Link to the admin interface

In order for your administrators to be able to access the content blocks admin page, your template needs to link to the ContentBlocks controller index action:

Use content blocks in views

Instead of hard coding content into views, output relevant content blocks. This means that administrators never need to make code changes (or employ someone to make code changes) if they require changes to most parts of the template.

This is done using the relevant ContentBlocksHelper functions:

Overriding admin page templates

For various reasons, you may want to customise the appearance of the admin pages. If this is the case, you can override the provided templates by creating a folder in your CakePHP application's templates folder called plugin (if you have not already), and creating the path ContentBlocks/ContentBlocks (that is, a folder inside a folder) inside the plugin folder. The directory structure should look like so:

Skipping Authorization check

You may see error messages such as The request to `/content-blocks/content-blocks` did not apply any authorization checks if you have implemented Authorization plugin in your project, but did not add policies required. You may need to skip the authorization check in the content-blocks plugin by adding the following configuration key:

Reference

HTML Block

Adding a HTML block

Add a new record to the content_blocks table with a type of html.

An example seed can be found in the HtmlBlockSeed.php file:

Rendering a HTML block

In a layout or view template, add the following:

Text Block

Adding an text block

Add a new record to the content_blocks table with a type of text.

An example seed can be found in the TextBlockSeed.php file:

Image Block

Adding an image block

Add a new record to the content_blocks table with a type of image.

An example seed can be found in the ImageBlockSeed.php file:


All versions of cakephp-content-blocks with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
cakephp/cakephp Version ^5.0
ext-json Version *
ezyang/htmlpurifier Version ^4.16
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 ugie-cake/cakephp-content-blocks contains the following files

Loading the files please wait ....