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 single page layout


Carry out the following steps:

  1. Create a file named view.php in your theme.

  2. Put the following code in it:

    <?php
    defined('C5_EXECUTE') or die(_("Access Denied."));
    $this->inc('elements/header.php');
    ?>
    
    <div id="content">
    <?php
    echo $innerContent;
    ?>
    </div>
    
    <?php $this->inc('elements/footer.php'); ?>

What just happened?

We've created another file in our theme which looks a lot like default.php. However, there's one major difference, view.php must always output the variable $innerContent. The content of single pages is generated by program code and saved in $innerContent.

Some controllers use more variables which you'll have to process as well in order to replace the concrete5 core layout. The login page for example has another variable in order to make sure errors are printed too.