Add Page Template

Essential Concepts

Before making a new page template, you should get a sense for what Concrete CMS is doing behind-the-scenes when you tell it to render a page.

First, Concrete looks in the active theme's directory for a file  whose name matches the unique "handle" of the page template and whose file extension is ".php". If it finds a file that matches, it uses the code inside to render the page. For example, the Left Sidebar page template uses left_sidebar.php to render the editable area, as well as HTML elements like container divs, etc.

But what if that left_sidebar.php file doesn't exist, or the filename doesn't match? concrete needs to render your page content somehow, so it uses the active theme's default.php file instead. This is important, since the next theme you activate might not contain the same page templates as the first – and we don't want to show an error to site visitors. We'd rather they see the content they were looking for!

 If you're following the steps below, please keep in mind that you'll need to have the correct PHP file in place in order to render anything besides default.php. More on what code is needed inside your page type can be found in our documentation. Another great way to learn is by checking out an existing page type's code. Even default.php is a great place to start.

Getting Started

From the Page Types page, click the "Add Template" button up at the top of the list. We'll fill in all the pertinent details in the next steps.

Screen_Shot_2014-10-17_at_5.10.36_PM.png

The Add Page Template page appears.

Screen_Shot_2014-10-17_at_4.42.09_PM.png

Name, Handle, and Icon

Here we can specify a name (how users will see it) and handle (your handle must be in all lowercase, no spaces, and not already in use). It's a good idea to make your name and handle relatively similarly-named, just in case you ever need to do some under-the-hood troubleshooting...or work with your page template, programmatically.

 

Finishing up...

When you're all set, click Save and you'll be returned to the Page Templates list. Your new Page Template will be included in the list, and you'll be able to apply it to any existing page, or use it when creating a new page.