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 – inserting block wrapper in area


While you can do a lot with the CSS layout feature in concrete5, it might be the case that you have to surround your block with some HTML code to style your site the way you want it to look like. There's a simple way to add some wrapping code around each block in an area, as follows:

  1. Once more, open a theme template like default.php and look for the place where you create the area.

  2. Replace the PHP block using the following snippet:

    <?php
    $b = new Area('Main');
    $b->setBlockWrapperStart('<div class="mainBlock">');
    $b->setBlockWrapperEnd('</div>');
    $b->display($c);
    ?>

What just happened?

The two lines of PHP code we've inserted in the preceding snippet simply surround each block in the Main area with a DIV element.

When you now create your CSS file, you can access them using .mainBlock. A few lines in your CSS file like the following will add a line at the bottom of each block:

.mainBlock {
border-top: 1px solid black;
}