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 the product list block


Carry out the following steps:

  1. Create a new directory in blocks named product_list. We start with the database model. Create a new file named db.xml in the new directory with the following content:

    <?xml version="1.0"?>
    <schema version="0.3">
       <table name="btProductList">
          <field name="bID" type="I">
             <key />
             <unsigned />
          </field>
          <field name="categoryID" type="I"></field>
       </table>
    </schema>
  2. Create another file named controller.php:

    <?php 
    defined('C5_EXECUTE') or die(_("Access Denied."));
    class ProductListBlockController extends BlockController {
       
       protected $btTable = 'btProductList';
       protected $btInterfaceWidth = "250";
       protected $btInterfaceHeight = "110";
    
       public function getBlockTypeDescription() {
          return t("Embeds a Product List in your web page.");
       }
       
       public function getBlockTypeName() {
          return...