When you create a new module you're asked to provide a class name. This is the PHP Class that will extend BigTreeModule which will act as a way to retrieve and modify data in your MySQL table. Your class files will be stored in /custom/inc/modules/ with the file name being (module's route).php.

By default, your module will simply be a class extending BigTreeModule with two variables set:

  1. Table — The MySQL table this class will work with.
  2. Module — Your module's "id" in bigtree_modules.

When pulling your module's data into the front end template, the recommended way is to use your module's class. For instance, if we have a class named DemoNews and want to pull five approved news articles with the latest first:

$newsModule = new DemoNews;
$articles = $newsModule->getMatching("approved","on","5","date DESC");
foreach ($articles as $item) {
echo "<h2>".$item["title"]."</h2>";
echo "<p>Date: ".$item["date"]."</p>";
echo $item["body_copy"];
echo "<hr />";

While you can just query your MySQL table directly, it's not advised. BigTree automatically converts hard links in your website into relative paths. If you're querying your table directly you may notice that a link to http://www.website.com/about/ turns into "ipl://5" or "{www root}about/". This is done so that if your page moves to another URL the link doesn't become invalid. Calling your class file's get method on your row from the database will change these relative links into hard links for display on your website.