Book Image

concrete5 Beginner's Guide

Book Image

concrete5 Beginner's Guide

Overview of this book

Table of Contents (19 chapters)
concrete5
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – creating a template folder


Follow these steps to create a folder for your templates:

  1. Create a new folder in blocks\page_list\templates called news_2.

  2. Copy the previously created news.php file into this directory and rename it view.php.

  3. Create a new file called view.css with the following content:

    .ccm-page-list {
       border-bottom: 1px solid gray;
       padding-bottom: 20px;
       margin-bottom: 20px;
    }
    .ccm-page-list a {
       color: #262626;
    }

What just happened?

We created a folder instead of a single file for our template. While view.php is mandatory, there are lots of optional files you can use. Within a template in the templates folder, the following are the files included by concrete5 in the header:

  • view.js

  • view.css

  • js/<anything>.js

  • css/<anything>.css

Whether you put the CSS rules in your theme or template using view.css or the css folder has to be decided for each situation. There's not a single correct answer. But think about whether you would like to reuse the template...