-
Book Overview & Buying
-
Table Of Contents
concrete5 Cookbook
At the heart of performing queries on the database in concrete5, is the database object. The database object exposes several methods that allow developers to perform queries on the database.
Have a look at the following steps:
We will need a place to play around with some test code. Open /config/site_post.php which will serve us well in your code editor.
Write the following code snippet to load the database object:
$db = Loader::db();
Now that the database object is loaded, take a look at some of the methods that it exposes:
$methods = get_class_methods($db);
Dump the array of methods to the screen:
var_dump($methods); exit;
concrete5 will use the database settings from your configuration file (likely located at /config/site.php) and connect to the database, returning an object containing several useful methods for interacting with the database.
If you'd like to connect to a database other than the one specified in site.php,...
Change the font size
Change margin width
Change background colour