How To Create Concrete5 Theme

add new theme in concrete5
add new theme in concrete5

How to create concrete5 theme: Concrete5 is a free and open source content management systems Concrete5 is very easy and user friendly CMS, Concrete5 has been around since 2008. Concrete5 is developed from the ground up using Model View Controller and Object Orientated Programming architecture and because of this, it is a powerful, easy to use CMS. PHP was used to create the structure of Concrete5 and it is often compared to the major CMS’s which are WordPress, Joomla and Drupal. I personally have created many websites using Concrete5 and for creating custom themes I found the process more straight forward than other content management systems such as WordPress.

How to create concrete5 theme ?

Assuming that you have correctly setup the SQL database and installation, it is fairly simple to create your own custom theme for Concrete5. For my example, I will show how to setup a theme with Bootstrap.

  1. Firstly, Setup Your File Structure FOR How to create concrete5 theme

Usually, this will include the four file directories: css (i.e. Bootstrap files and Style Sheets), docs (optional), img and js (i.e. Bootstrap files).

 

  1. Create a default.php file

The Default PHP file is used for Concrete5 pages that have no Page Type, for example the home/index page. If you are converting your HTML website into a Concrete5 site, simply copy your code over to a new file called defualt.php. The file will be very similar to ordinary HTML files apart from a few php snippets that you must include for the CMS to be able to read the file and put sections in the correct place for editing.

First of all, within your tags, you must include

Loader::element(‘header_required’);

, which grabs a file called header_required from the concrete elements, which inserts the page title, the content type and the character set. For the later versions of Concrete5, you must now include a footer element, which is placed just before the end body tag as so:

Loader::element(‘footer_required’);

Finally, for Concrete5 to read your external resources, you need to insert a PHP snippet within the link or script source.

echo $this->getThemePath()?

Now we have setup the base, we now need to setup editable areas on the page. These editable areas allow you to insert plugins, content or html code from within the CMS. Using Bootstrap, you can either setup the grid layout through the page type or just set one area and within Concrete5, use the HTML tool to setup your grid layout. To add an editable area, simply include the following between tags:

   $a = new Area(‘Area Name’);
$a->display($c);

Below is an example with Bootstrap grid layout included (within body tags):

Obviously you can play around with the Bootstrap layout to your own preference, but remember to change the name of the area, unless you intend to duplicate them.

 

  1. Create view.php

The View PHP file is require to wrap single page types single pages or non theme pages. For example, if you intend to create blogs, then this file will be used as the page type. In view.php instead of main content area you put code

print $innerContent;

  1. Create description.txt

Concrete5 requires a text file with a description of your theme, therefore, on the first line you will put the title of the theme, and on the second line include a brief description of the theme.

  1. Activate The Theme in Concrete5

Once you have uploaded the theme into the correct directory (public_html -> themes -> (Your Theme Name) -> [Place Here]) you will then need to activate it through Concrete5. To do this, click on “Dashboard” and then “Themes” and you should see you theme with the title you from description.txt. Install the theme and then activate it, which you should then be greeted with a success message. Your theme is then successfully installed.

  1. Multiple Page Types

In many cases, its easier to create a new page type for a certain type of page that will be replicated in multiple ways i.e. a location landing page. Therefore, following the same format as default.php, simply create another PHP file and upload it to the server. To use the template through Concrete5, you will then need to add it as a Page Type through Dashboard -> Themes -> Add Page Type. Call the Page Type any name, but the package the name of the PHP file that you uploaded to the server.

NOTE: Before editing the the default settings of the page type, its important to clear cache, otherwise you will be greeted with the default.php.

If you want to create concrete5 website contact jsm team