O'Reilly logo

CMS Made Simple Development Cookbook by Samuel Goldstein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a database table when a module gets installed

Although a few modules interact only with the core CMS Made Simple database tables, most of the modules you will create will have a need for their own data storage. Fortunately, the module API provides you with methods for creating database tables in a database-independent fashion.

The module installation method is the ideal place to create any database tables your module will need. This recipe shows you how, using the example of a module for organizing music collections.

How to do it...

  1. Using any of the methods described in Chapter 4, Getting Started with Modules, create a new module stub for your Music Collection module.
  2. Using your favorite editor, edit your module's method.install.php.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required