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 – moving the PDF block into the package


Some blocks depend on helpers, files and libraries, which aren't in the block directory. The PDF generator block is such an example. It depends on a file found in the tools directory in the root of your concrete5 website. How do we include such a file in a package?

  1. Move the pdf directory from blocks to packages/c5book/blocks since we also want to include the block in the package.

  2. Locate the c5book directory within packages and create a new subdirectory named tools.

  3. Move generate_pdf.php from tools to packages/c5book/tools.

  4. Create another directory named libraries in packages/c5book.

  5. Move the mpdf50 from libraries to packages/c5book/libraries.

    As we've moved two objects, we have to make sure our code looks for them in the right place. Open packages/c5book/tools/generate.php and look for Loader::library at the beginning of the file. We have to add a second parameter to Loader::library, as shown here:

    <?php
    defined('C5_EXECUTE') or die(_...