Could we make a database query on themes ../items/show.php?

I used this script to make a query from this items/show.php

$db = $this->getDb();
$stmt = $db->query("SELECT * FROM tb_oauth WHERE id_oauth = 'box_sandbox'");
$OAUTH = (array)$stmt->fetchObject();

but it returns some error like this:

Plugin by name 'GetDb' was not found in the registry; used paths:
ExhibitBuilder_View_Helper_: /chroot/home/devpinal/
Omeka_View_Helper_: /chroot/home/devpinal/
Zend_View_Helper_: Zend/View/Helper/

help me please..

ouch... i found the answer.. :) thanks, i just found the answer after read this forum.. :)


So give your answer...

Technically, you can use database query from theme, but this is not recommended. Omeka and Zend follow the MVC (model-view-controller) architecture, so in theme (view), you should just apply a display to data you get from the controller. So this query should be done in a specific plugin.


Daniel Berthereau
Infodoc & Knowledge management