I have been browsing through the G3 MySQL tables, specifically the `items` table, and would like to write some PHP to grab data from the table.
Specifically, I would like to get a list of albums so that I can display an HTML list of them.
Is there a recommended way for me to access the MySQL db via my custom theme (is this functionality a part of the system)?
Edit: Should I be looking into understanding the Kohana framework?
Thanks!
http://www.miketmoore.com
Posts: 29
You want something like:
$items = ORM::factory("item")
->viewable()
->where("items.type", "=", "album")
->find_all();
More generally, ORM::factory() is what you want for interacting with the database.
Also, modules/gallery/libraries/ORM_MPTT.php shows a bunch of methods you can use on these items to help work your way around the tree for a given item.
There are a lot of modules that interact with the database. Grepping around for ORM::factory() calls, seeing how they're used, and what's done after should help you with the DB access.
--Carl