Сделайте это, следуя структуре каталогов ZF:
Создание помощников действий для контроллеров и просмотр помощников для представлений:
В папке вашей библиотеки, которая установлена в set_include_path:
create library/My/View/Helper/Common.php
Как показано ниже:
class My_View_Helper_Common extends Zend_View_Helper_Abstract
{
public function common()
{
return $this;
}
public function getCity($id)
{
$registry = Zend_Registry::getInstance();
$DB = $registry['DB'];
$result = $DB->fetchPairs("select * from firm_dtl");
return $result;
}
}
ИЛИ Call in View:
$this->common()->getCity($id);
Тот же процесс для помощников действий:
Сделать в библиотеке / My / Action / Helper / Common.php