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 – including an existing template


You can include an existing template on your concrete5 site by taking the following steps:

  1. Create a new file at the following location:

    blocks/content/templates/wrapper.php.

  2. Enter the following code in the new file:

    <div class="content-wrapper">
    <?php 
    $bvt = new BlockViewTemplate($b); 
    $bvt->setBlockCustomTemplate(false);
    
    include($bvt->getTemplate());
    ?>
    </div>
  3. Save the file and go back to your concrete5 site.

  4. Add a new content block and click on it after you've hit Update and select Custom Template.

  5. Select Wrapper and update again.

  6. When you look at the HTML code generated by concrete5 you'll find an additional DIV with a class called content-wrapper.

  7. You can use this class in your CSS file called main.css. Add a rule like this to change the background color:

    .content-wrapper {
       background-color: silver;
    }

What just happened?

We created a new template which basically includes the existing content block default block template...