zend-controller

Hooking into the Error processing cycle

给你一囗甜甜゛ 提交于 2020-01-14 05:16:56
问题 I'm building a monitoring solution for logging PHP errors, uncaught exceptions and anything else the user wants to log to a database table. Kind of a replacement for the Monitoring solution in the commercial Zend Server. I've written a Monitor class which extends Zend_Log and can handle all the mentioned cases. My aim is to reduce configuration to one place, which would be the Bootstrap. At the moment I'm initializing the monitor like this: protected function _initMonitor() { $config = Zend

Unable to access module forms in module controller

折月煮酒 提交于 2019-12-24 14:58:36
问题 I have a test module. In test module I have a Form in forms folder. myproject/application/modules/test/forms/TestForm.php class Test_Form_TestForm extends Zend_Form { //form elements } myproject/application/modules/test/controllers/TestController.php class Test_TestController extends Zend_Controller_Action { public function indexAction() { $this->view->form = new Test_Form_TestForm(); // this is generating error } } // end class Form initialization in controller is generating following error:

Zf3 controller not able to access the model class table located in another module

寵の児 提交于 2019-12-22 12:12:12
问题 I am new to Zend Framework. Is there a way to access the model class table which is located in another module from my active controller? As its bye bye service locator in ZF3 i am not able to access the model class table located in other modules. Previously in ZF2 controller private configTable; public function getConfigTable() { if (!$this->configTable) { $sm = $this->getServiceLocator(); $this->configTable = $sm->get('Config\Model\ConfigTable'); // <-- HERE! } return $this->configTable; }

Zf3 controller not able to access the model class table located in another module

梦想与她 提交于 2019-12-22 12:11:06
问题 I am new to Zend Framework. Is there a way to access the model class table which is located in another module from my active controller? As its bye bye service locator in ZF3 i am not able to access the model class table located in other modules. Previously in ZF2 controller private configTable; public function getConfigTable() { if (!$this->configTable) { $sm = $this->getServiceLocator(); $this->configTable = $sm->get('Config\Model\ConfigTable'); // <-- HERE! } return $this->configTable; }

Control access to files available for download

亡梦爱人 提交于 2019-12-19 04:55:16
问题 I have a folder that contains uploaded documents that my ZF application can spit out to logged in users. I want them to be able to use a link like http://server/documents/filename.pdf and download the file, but I want to have a controller DocumentsController that enables the existing user cookies to verify that they are logged in and have permission to download the file. I don't want to have to use URLs like http://server/documents/index/id/1 if I don't have to, though its not a terrible

Zend keep front controller from blocking image requests

荒凉一梦 提交于 2019-12-11 19:49:01
问题 Anytime I use an <img> tag in my Zend Framework application, no image is displayed. When I type the absolute path into the address bar, the front controller attempts to find an "images" controller. There HAS to be a way I can use <img src="/public/images/logo.png"> in Zend Framework right? I've tried it from within views, layouts, and helpers, and no luck. I've also used the $this->baseURL() technique, and the serverURL() technique by getting the info from the Front Controller, but it still

How to add a third-party Action Helper to a Zend Framework 1.8+ application?

本小妞迷上赌 提交于 2019-12-11 16:59:05
问题 I have downloaded a third party action helper that I would like to add to my application. How can I do this? 回答1: Using the Noginn SendFile Action Helper as a reference, dropped into the library directory, the directory structure looks like this: /library /Noginn /Controller /Action /Helper /SendFile.php In /application/Bootstrap.php add an init function and add the class prefix: protected function _initActionHelpers() { Zend_Controller_Action_HelperBroker::addPrefix('Noginn_Controller_Action

How to attach css and javascript files in zf2 controller?

≯℡__Kan透↙ 提交于 2019-12-11 10:26:54
问题 i attach some stylesheets in zend controller but blank page shown,how i include stylesheets and javascript files in zend controller?here is my code: public function showAction() { //css $this->viewHelperManager->get('headLink')->appendStylesheet('/css/style.css'); $this->viewHelperManager->get('headLink')->appendStylesheet('/css/bootstrap-theme.min.css'); $this->viewHelperManager->get('headLink')->appendStylesheet('/css/tweaks.css'); $this->viewHelperManager->get('headLink')->appendStylesheet

Zend_Form:: When should be form created in view and not in controller?

岁酱吖の 提交于 2019-12-11 00:06:17
问题 Zend_Form:: When should be form created in view and not in controller? option 1 - form created in controller and passed to view (usually used) controller: $form=new MyForm(); $this->view->form=$form; view: echo $this->form; option 2 - form created in view directly (looks better to me because form its subpart of view) view: $form=new MyForm(); echo $this->form; Thanks 回答1: In short: newer in view . You may eventually: create view helper for complex tasks (and call the helper in view $this-

Zf3 controller not able to access the model class table located in another module

走远了吗. 提交于 2019-12-06 10:39:19
I am new to Zend Framework. Is there a way to access the model class table which is located in another module from my active controller? As its bye bye service locator in ZF3 i am not able to access the model class table located in other modules. Previously in ZF2 controller private configTable; public function getConfigTable() { if (!$this->configTable) { $sm = $this->getServiceLocator(); $this->configTable = $sm->get('Config\Model\ConfigTable'); // <-- HERE! } return $this->configTable; } public function indexAction(){ $allConfig = $this->getConfigTable()->getAllConfiguration(); ...... } As