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 – printing block output


Carry out the following steps:

  1. Last but not least, we have to make sure the data we save in the block gets printed on the page. For this, we have to create a file named view.php.

  2. We've got to access and print the file object along with some basic commands to print the value of our variables. The content of the file has to look like this:

    <div class="product-information">
    <?php
    $html = Loader::helper('html');
    
    $picture = $this->controller->getPicture();
    
    echo "<h2>{$title}</h2>";
    if ($picture) {
       echo $html->image($picture->getURL());
    }
    echo "<p>{$description}</p>";
    ?>
    </div>
    

What just happened?

The last part, the actual rendering of the content, is rather short. We did use another helper, html, to print our image element. We could have built this string manually, but which option you choose is up to you. We also used getPicture again to get a file object from the controller. Besides these two commands...