zend-framework

Using forms with the Zend Framework

I'm relatively new to MVC and the Zend Framework. That being said, I feel like I have a hard time figuring out where Forms belong in my directory structure. I have a modular directory structure, so I don't know if there should be a single forms directory, or one within each module directory. /application /modules/ /default ...

Zend Framework Lucene Boolean / "Google"-like search

I'm working on the application at http://demos.zatechcorp.com/codeigniter/ In its current incarnation running on my machine, I loaded the ZendFramework inside Codeigniter, and generated an index, like this: // ... Some code that loads all the markets foreach ($markets as $market) { $doc = new Zend_Search_Lucene_Docu...

Cache-Control Header Modified By PHP Session?

I'm outputting an image to the browser using a Zend_Controller_Response object. It is my intention to apply caching to the image, however something is causing the Cache-Control header to be overwritten. My code is as follows: $this->getResponse() ->setHeader('Last-Modified', $modifiedTime, true) ->setHeader('ETag', md5($modifi...

Zend: Is it possible to send view variables after a redirect?

How could I send additional view parameters after I have done a redirect (e.g. $this->_redirect->gotoSimple();)? For example, let's say I have an Edit action which will redirect the user to an Error action handler and I would like to be able to send custom, detailed error messages to its view. To illustrate it clearer, the flow would be...

Best way to embed Login Form in Zend Framework pages

What is the best way to embed Login Form into several pages in Zend Framework? Currently I have two controllers, LoginController for separate login form and IndexController for actions on index page. I need to include Login Form into index page to let users log in both from the front page and from Login page. My current solution is to...

encode array to JSON in PHP to get [elm1,elm2,elm3] instead of {elm1:{},elm2:{},elm3:{}}

I am trying to json_encode an array, which is what returns from a Zend_DB query. var_dump gives: (Manually adding 0 member does not change the picture). array(3) { [1]=> array(3) { ["comment_id"]=> string(1) "1" ["erasable"]=> string(1) "1" ["comment"]=> string(6) "test 1" } [2]=> array(3) { ["comme...

Problems with encoding Json request

I try to manually build a Json string to send to the client. {'result':'hhh'} When I use echo json_encode(array('result'=>'hhh')); It arrives perfectly. But when I do echo "{'result':'hhh'}"; It isn't The only difference I find between the two requests is that the first one has: Content-Length: 9 header and the second o...

Zend Framework MVC Design

I've asked this question on the zfforums as well, but I maybe I'll get a response here. So the Zend Framework is a general purpose, flexible, loosly coupled, high quality framework. However, I find some of the MVC parts inconsistent and overly complex. Hopefully some of you can justify some of the zf design decisions and answer some que...

postgresql sequence problems with lastinsertid and zend framework

Hi I have just started working on a project and I am using zend framework and postgresql (normally use MySQL) however I am hitting a problem when I am trying to get the last inserted id when using the Zend_Db insert command. When using the function $db->lastinsertid('users', 'userid'); I get the following error message: SQLSTATE[42P01...

Zend Framework Forms - How to I make a control an array

Using Zend form how would I make a control (element) an array? An example use case: I have a list of items and I want each item to have it's own checkbox on a form, but those checkboxes should post as an array. This means that each checkbox name is 'item[]'. How can I achive this using Zend Form? I have tried setting the isArray proper...

Php on zend, how to escape a variable for a query?

Hello, im doing some queries in Zend Framework and i need to make sure no SQL injection is possible in the next kind of formats. I can use mysql_escape(deprecated) and wont do all the work. If i try to use real_mysql_escape it wont be able to grab the conection with the database and i cant find how zend_filter would solve the problem. ...

CSS not applying correctly in ZendFramework

Hello guys, am new to zend framework. Am having a little problem and a real hard time solving it myself. If i access my zend application by going to http://localhost/zendapplicationfolder/contact it displays correctly with css applying correctly but if i access the zend application by going to http://localhost/zendapplicationfolder/cont...

How to change include directory of Zend Framework

I get the following error messages: Warning: include_once(Zend\Db.php) [function.include-once]: failed to open stream: No such file or directory in C:\EasyPHP3\www\VPZ\Lib\Zend_1.7.7\Loader.php on line 83 Warning: include_once() [function.include]: Failed opening 'Zend\Db.php' for inclusion (include_path='VPZ/') in C:\EasyPHP3\...

what is best way to improve performance of zend framework?

zend framework has many components/services I don't need, it has many includes. All this I think slow down application. Do you know how to speed up it? may be remove not used(what is common) components, or combine files to one file? ...

installing zend framework with wamp server

Im trying to install zend framework with wamp server but it is not working properly. I downloaded the zend framework and the create the folder in C:\wamp\library\Zend and then in php.inc I got something like this ; Windows: "\path1;\path2" ;include_path = ".;c:\php\includes:C:\wamp\library" Now when i try to run the sample blogger.ph...

Zend Framework - Static form elements

I have got a form which a user can use to create a new store and to edit an existing one. When this form is being used to edit a store there are certain fields that I want the user to see but not edit eg. store_id. I have explored the different Zend_Form_Elements hoping to find some kind of static element but with no luck. So my questi...

I got Some Zend Message Error when Working Zend Database

I get the following error message: Fatal error: Uncaught exception 'Zend_Exception' with message 'File "Zend\Db\Adapter\Mysql.php" does not exist or class "Zend_Db_Adapter_Mysql" was not found in the file' in C:\wamp\www\VPZ\Lib\Zend\Loader.php:88 Stack trace: #0 C:\wamp\www\VPZ\Lib\Zend\Db.php(247): Zend_Loader::loadClass('Zend_Db...

How to put 2 buttons in a row in one Zend_Form

I assume it's a common requirement to have forms in your web apps that have Edit Delete buttons under them. But ZF puts one button under another, which is counter-intuitive. I guess ViewScript decorator could help me completely override button html. But how to do it across other forms, to avoid duplicating? May be I am overcomplicating ...

How to Handle 'Sometimes' Inheritance?

I have a situation utilizing class table inheritance where the base object (which is abstract) is extended by specific types of the object. For example, Person --> User --> Prospect However, in some instances like with Prospect, sometimes it extends User and sometimes it doesn't. I can't reverse the relationship because User !== Prospe...

Zend Framework very bad performance on WAMP

I am developing a project on windows with wamp installed using zend framework. Unfortunately it has very slow performance, although I did the things mentioned in the manual: remove require once added apc I recently installed Scienta ZF Debug Bar v1.3, and here is an example of results i get: Queries: 48 in 53.01 ms Memory: 9188...