zend-framework

Overview of Zend and scoping, singletons, etc...

I've searched for Zend discussions on scoping and I know there are framework nuances that would seem to indicate there is some server-side memory, but I can't pin it down for sure. Does the existence of Singletons indicate that they are loaded once per Application, or once per session? It doesn't make sense that a Singleton should be de...

Trim leading and trailing white spaces in JSON values

All, I make a JSON request to a web server using PHP and it returns me a JSON response in a variable. The JSON response will have lots of keys and values. I would like a function which trims leading and trailing white spaces in each "value" of the key-value pair for the entire JSON response. How can I do that through PHP? Ex: json_dec...

How to model and track requirements towards a goal in PHP

I'm building a webapp using the Zend Framework, and I need to model logic or keep track of some logic that has to do with tracking progress towards a goal. Let me illustrate with a sample goal. USER Needs to Complete All Three of the following: A) Activity One B) Activity Two C) Activity Three USER Needs to Complete One ...

Zend Framework: What is the right way of setting default decorators for Zend_Form elements

i currently set my default decorators for my Zend_Form using a class extending from Zend_Form ... class Application_Form_Abstract extends Zend_Form { ... function loadDefaultDecorators() { if ($this->loadDefaultDecoratorsIsDisabled()) { return $this; } // ... for elements $decorator...

Zend Framework/Form Elements: Create custom class or?

the result i want is a textarea that hooks up to WMD (markdown editor). and include a div.wmd-preview element. what i have currently is in my forms (extending Zend_Form) ... i add the functionality thru decorators // init() $this->addElement('textarea', 'bio', array( 'label' => 'Bio', 'description' => '<a href="http://daringfire...

Catch and log fatal errors, warnings, notices in Zend Framework

Currently I am using a basic error controller which looks like this: class ErrorController extends My_MyController { public function errorAction() { $errors = $this->_getParam('error_handler'); switch ($errors->type) { case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE: case Ze...

Dojo parse unparsed widjits

Zend framework adds the dojo.parser.parse(); to your script if you have widgets on the page, but not if you don't - makes sense. But I have a common js file which should set up lightbox images within all pages, and for this i need dojo.parser.parse(); to be included. I can add it to my common js file, but if I do, the parser runs twice a...

ZF, How to generate Entities with Doctrine 2

Hello, I recently decided to try Doctrine 2. I manage to partially integrate it to Zend. The command line works and I manage to interrogate the database. The problem comes with the generation of my differents entities, proxies,... Before, with Doctrine 1.x, we could generate, start with our database, the YML files and business classes. ...

YAML adapter for Zend_Translate?

Does anybody know a high-quality yaml adapter for Zend Framework's Zend_Translate? There seems to be a proposal in the Zend project itself, but it's been inactive for years. ...

Zend Framework: Routing seems to interfere with rendering of Zend_Navigation menu

i have setup a route like below in bootstrap.php $route = new Zend_Controller_Router_Route( 'users/:id', array( 'controller' => 'users', 'action' => 'view' ) ); $router->addRoute('viewUser', $route); when i try to goto /users/1, and in view script do echo $page->getHref(), i get Fatal error: Zend_Cont...

How to know which route was selected?

Hi everybody, I have created a function in the bootstrap to do the routing. Once a route has been selected I would like to know which one it is. Ideally I would like to be able to get that information in the bootstrap too, let's say I have a 1st function _initRouting() which decides of the routing and then later in the bootstrap a 2...

Text email template in using Zend_View losing line breaks

I'm using Zend_View to template text email content. However, I've come across one problem which I have been unable to solve: If a line ends with a php block (?>), then the line break is lost. Does anyone have any idea how I can solve this? The application is using Zend framework, but I have no particular reason to use Zend_View to rend...

Zend Framework - Loading View Helpers from Modules

Hi, I am putting together a modular application in Zend Framework and am struggling to get module specific View Helpers to load. My directory structure is like this... application ---configs ---controllers ---forms ---layouts ---models ---modules ------user ---------controllers ---------forms ---------modules ---...

Posting JSON string using dojo.xhrPost

Hi, I am having an issue trying to post a JSON string using dojo.xhrPost to a Zend Framework Controller. When I post the string to the server I get no data being sent. I've even tried just sending "A Test string", even that is not being sent. I've done a var dump to see the contents of the request but clear as day, there is no para...

How to merge XML data into a PDF form that resides on server in PHP and then download a merged PDF?

Hello there, we are trying to find the best solution for merging an XML data coming from an HTML form that the user is filling, with the PDF "template" form that resides on the server. After submitting the form in the browser, user should be able to download his/her merged PDF. I have found similar questions regarding FDF and PHP but n...

zend framework problem with paths

I have installed zend framework on my local machine. I have configured a vhost in httpd.conf and have added a line in my hosts file (127.0.0.1 mysite). I am running windows 7. Everything works perfect. The problem is when i upload on a hosting server the paths get mixed up. I am uploading on a remote dir called zf-framework. To access t...

Zend Framework Chained routes - getMatchedPath

I have several chained routes that handle the multi-lingual feature of my site. Sample: $languageRoute = new Zend_Controller_Router_Route_Regex('(de|en|es|fr|it|ja|ko|pt|ru|zh)', array(1 => 'en',), array(1 => 'language'), '%s' ); $defaultRoute = new Zend_Controller_Router_Route('*', array('module' => 'default', 'controller' => 'p...

Json_encode, json_decode and UTF8

All, I make a JSON request to a web server using PHP and it returns me a JSON response in a variable. The JSON response will have lots of keys and values. The JSON response I get from the server has special characters in it. So, I use the following statement to convert it to UTF8,decode the JSON and use it as an array to display to the ...

The Zend Framework way of storing modified classes?

I have a project that uses Zend Framework and Zend_Translate. I had to alter the standard CSV Adapter to Zend_Translate slightly. Now I'm confronted with the question where to put this altered adapter. By default, adapters are stored in /Library/Zend/Translate/Adapter/Adaptername.php This is where I've put the new adapter as well. ...

Zend_Test_PHPUnit_ControllerTestCase and Zend_Layout, unable to find Layout plugin while running tests

I am starting to write some test cases for controller classes using Zend Framework 1.10.6 and Zend_Test_PHPUnit_ControllerTestCase. I am having problems with one item, which is that while the test cases are running, Zend_Controller_Action_HelperBroker can't find the Layout action helper. Here are the bare bones of my test case: requir...