zend-framework

Zend_Db: Adapter suddenly is null!

Hey there, I'm using Zend_Db in one of my projects. Now I have the problem, that suddenly during the code execution, the variable $_db in Zend_Db_Adapter_Abstract is null. (shown by var_dump($this); in my DbTable_xx class). It seems like the adapter is set to null somewhere during the script execution. How can that happen? Unfortuna...

Zend Framework : Setting up default values for part of the multicheckbox element options not possible

Hello, I'm writing this question cause I have difficulties setting up default values for a _MultiCheckbox element of a Zend Framework 1.9.3. I create Zend_Form_Element_MultiCheckbox with multiple options like this: $multiCheckbox = new Zend_Form_Element_MultiCheckbox( 'elId', array ( 'disableLoadDefaultDecorators' =>true ) ); $multiCh...

What's wrong with this route?

protected function _initRoutes() { $this->router = $this->frontController->getRouter(); $route = new Zend_Controller_Router_Route( ':username', array( 'module' => 'default', 'controller' => 'view', 'action' => 'profile', 'username' => ':username' ) ...

How to set either Zend_Form_Element_Text required?

Hi, I'm new to Zend Framework, I have a question is that if I have two Zend_Form_Element_Text in a form, and I want make either of them to be filled by the user. For example, phone number and mobile number. People only need enter one of them to continue. How am I going to do this? Thanks ...

Zend Framework and switching view script paths

I have a problem. Basically, depending on whether a user goes to /es or /br or /cn etc on our website, we have different language template files. So far, we were using a custom templating engine to make this work, but are making a switch over to ZF. I can't seem to figure out how to get ZF to look for a view script in say cn/about-us if ...

Use setControllerName and setActionName in Zend Framework doesn't change the actual url?

I am working on a authentication class with Zend Framework. I added a predispatch function in Zend_Controller_Plugin_Abstract to check the user login status. public function preDispatch(Zend_Controller_Request_Abstract $request) { if (!$logined){ $request->setControllerName('auth')->setActionName('login'); } } if user is not logine...

urlencode() error when using Zend_Controller_Router_Route and URL view helper

I am using the standard router in Zend Framework to route most URLs in the system. For one particular URL, I want to access it via a controller alias (in addition to the real controller) For example. Actual URL: /mymodule/mycontroller/myaction/* Alias URL: /mymodule/mycontrolleralias/myaction/* mycontrolleralias is not a real co...

How to get Zend Lucene Range Search working properly (or help me debug)

I have an implementation of the Zend Search (Lucene) framework on my website that contains an index of products with prices. I am trying to allow customers to search for something, while contsraining the prices. Eg. Search for "dog food" between $5-$10 dollars. My search index looks like this: Keyword('name') Keyword('price') Lets sa...

What is the best Field Type/Encoding to store a number in a Zend Lucene Search Index?

Hello, How would I index a price int field in a Zend Lucene Search Index? I am currently using: $doc->addField(Zend_Search_Lucene_Field::Keyword('price', $price, 'utf-8')); Is this the correct way? Or should I be storing it specifically as a number somehow? ...

How do you make Zend Framework NOT render a view/layout when sending an AJAX response?

Zend's documentation isn't really clear on this. The problem is that, by default, Zend automatically renders a view at the end of each controller action. If you're using a layout - and why wouldn't you? - it also renders that. This is fine for normal Web pages, but when you're sending an AJAX response you don't want all that. How do you...

Zend Cache doesn't kick in

Ok, here's the problem: $frontendOptions = array( 'lifetime' => 7200, 'debug_header' => true, // for debugging, but it doesn't work.. regexps' => array( // Cache the static pages '^/pages/' => array('cache' => true), ) ); $backendOptions = $config->cache->backOptions->toArray(); // getting a Zend_Cache_...

MVC: how to ajax?

I'm going to start a project using a Zend Framework MVC implementation. How do I work with ajax? I mean, should I place all ajax code into controller? Or into view? For example, I want to get posts from author 'ivan' to show on a page. Normally, I create a link to '/posts/author/ivan' or smth like it, create a new Action like 'byAutho...

How easy is it to extend / modify Zend Framework?

I've recently begun building version 2 of my year-old custom MVC framework. It's worked great for me on a number of projects, but I definitely see room for improvement. It's missing some major functionality like ACL, form validation, and caching. As much as I'd love to build those parts myself, I know that realistically it's not a smart ...

Cross Site Authentication and Zend Framework

I have been asked to implement a cross site login solution in Zend Framework. I have thought about perhaps using OpenID, are there any other solutions to make a login persist across many sites? In some ways a closed system hosted by us would suit better. ...

custom error messages with Zend_Filter_Input

Hi, I'm using Zend_Filter_Input to sanitize input from a registration process. My code looks like so: $validators = array( 'user_id'=> array( array('Alnum', TRUE), 'NotEmpty', 'presence' => 'required', 'messages'=>array('Your username can contain only alphabetic or numeric letters, and must be bet...

What is the current way in which I can add an object to the database using Zend Framework?

I want to save an object or form to the database. Only I can't find the easiest (or normal) way for how to do this. I found a lot of tutorials, but none seem to be easy or current. Can someone please help me with this? I use version 1.9.3 of the Zend Framework. ...

How should I create this customized e-commerce database model?

I am building an e-commerce website from scratch and have to make a special product configuration page. It's only 1 type of product, but it is configurable on several levels: Color (about 4 different options). Value is a VARCHAR. Material (about 10 different options). Value is a VARCHAR. Size (About 30 different options). Has 2 Val...

Zend Lucene misbehaving: Queries work one by one but not together.

Ok, so here's the deal: Lucene does the weirdes things to me. Everything is indexed properly, everything works, everything's fast etc etc. So I search for a category in English. Hundreds of results pop out. So I search for a country in English. Hundred of results pop out. So I search for a category AND a country in English. A combinat...

Extending the IndexController with a BaseController in Zend

I'm trying to extend my controllers with a global base controller as such: class BaseController extends Zend_Controller_Action { // common controller actions public function listAction() { // do stuff } } class IndexController extends BaseController { // index controller specific actions } class LoginController exten...

How do you handle library dependencies during deployment using PHP?

Hey guys - this is a question on PHP mainly. I was wondering: How do you make sure that all necessary libaries are packaged with your application when you do a deployment to (production) servers? A more concrete example: I have an app running on Zend Framework and each time I roll the application to a server the deployment process crea...