zend-framework

Zend Framework html form input element with whitespaces

When I create a html form like this: $form = new Zend_Form(); $form->setMethod('post'); $form2->addElement('textarea', 'Name with Space'); The HTML becomes: ... <textarea name="NamewithSpace" id="NamewithSpace" rows="24" cols="80"></textarea> ... Mention that the input name becomes camelcase! When I call $form->getValues(); after ...

How to disable/readonly some checkboxes from a MultiCheckbox?

I have a Zend_Form_Element_Multicheckbox and I want to put some of its elements in a readonly state, how do I do that? $colId = new Zend_Form_Element_MultiCheckbox('colId'); $colId->setLabel('Col ID') ->setMultiOptions(array_flip(array('sadda', 'asss')); ...

Is there a Rows property for the Zend_Db object?

Looking for a property that will give me the number of rows returned on a query. ...

How can I implement multiple inheritance amoung resources in Zend Acl?

Long story short: why does Zend ACL support multiple inheritance among roles and not resources? I have a large tree of resources that I would like to be able to grant permissions on. In the past, what I have done to represent this is creating two different trees. The first one has a generic resource of each type in a tree. The second ha...

Zend/Apache mod_rewrite... what's wrong?

The following url works ok: http://localhost/index/index/ However, I am unable to _get$ variables when they come in like this: http://localhost/index/index/test/1234/test2/4321 -but- I can however, _get$ the variables these ways: http://localhost/index.php?test=1234&amp;test2=4321 http://localhost/index?test=1234&amp;test2=4321 h...

Is there a way to auto filter the getRequest() params in Zend?

I don't really want to call the Zend filter in my code after every getRequest->getParam('x') if I don't have to. Is there a lazy way of filtering everything inside getRequest magically? Edit: When I say filter, I mean, escapting tags, cleaning out the XSS, and escaping any sql escape characters. i.e: $myVar = $this->getRequest()->get...

How do I centralize code from my init functions in all controllers?

public function init(){ $this->view->user = Zend_Auth::getInstance()->getIdentity(); $this->view->siteName = Zend_Registry::get('config')->site->name; $this->view->menu = $this->_helper->generateMenu(Zend_Auth::getInstance()->getIdentity()); $this->view->slogan = Zend_Registry::get('config')->site->slogan; } Thi...

Zend_Db Question... updating an incrementor

Should this work? (increment the login count?) // update the login count $data = array( 'logins' => 'logins + 1' ); $n = $db->update('users', $data, 'user_id = '.$_userId); ...

First time building paypal ecommerce website - how to do it right?

Hi guys, this may come as pretty odd but I'm now working on a membership based website where users sign up and choose mode of membership which would be on monthly, quarterly or yearly payment basis. Its going to be paypal based. However despite having worked 5 years I haven't ever working on any ecommerce project before :\ instead I've w...

Dynamic Default Module in Zend Framework

Does anyone know of a way to set the default module dynamically in Zend Framework and not run into namespace issues? For example, what I want to do is have a table of modules that are allowed to be loaded, with one of them set as the default module. For example, I may have: admin blog calendar as modules that can be loaded. If I have ...

How to extract the full url (subdomain,domain and directories) with ZF?

Is there a way, using the functionality in ZF, to get the full url (http[s]::/xxx.yyyy.ddd/ggg/hhh) I am currently in? baseUrl() will only give me the path, not the domain and sub domain. I know how to extract it from the $_SERVER, trying to avoid that. ...

Multi-page AJAX form with conditional subsections

I would like to go about creating a multi-page form that changes based on options that are selected on previous pages of the form. I want to use Zend_Form, and I know JavaScript will be in charge of making the different form fields appear/disappear, but I don't know how the two will work together exactly. My question is how to get star...

Calling member function of other controller in zend framework?

Is it possible to call the member function of another controller in zend framework, if yes then how? <?php class FirstController extends Zend_controller_Action { public function indexAction() { // general action } public function memberFunction() { // a resuable function } } Here's another contro...

Get all modules, controllers and actions from a Zend Framework application

I want to create a Zend Controller for ACL management so my problem is: Howe can I get all Module names, Control names and Action names in a Zend application to build a ACL Control? I use Zend_Navigation and if the resource don't exist in your ACL Zend_Navigation is thrown a exception. And I want to use a database to deny and allow acce...

What should resources be in an ACL? Models of objects or the instances of the objects?

Please help me implement access control lists for my PHP web application. I'm using Zend_ACL specifically. I want fine grained, application wide control over what specific entity (be it a user or group) has access to what resource. I would like to be able to grant access to a particular resource instance, but also to all resources of th...

Returning multiple rows per row (in Zend Framework)

I have a MySQL database containing these tables: sessions -------- sessionid (INT) [courseid (INT)] [locationid (INT)] [comment (TEXT)] dates ----- dateid (INT) sessionid (INT) date (DATE) courses ------- ... locations --------- ... Each session has a unique sessionid, and each date has a unique dateid. But dates don't necessarily...

Zend_Form and Liskov Substitution Principle

A very common pattern I see (I'm picking on Zend Framework, only because I was dealing with it at the moment of this question), is something like this: class My_Form extends Zend_Form { public function init() { $this->addElement(); } } Zend_Form is not an abstract class, but is perfectly usable on its own. This see...

Example of a Multi Condition Delete with Zend framework

Can someone give me an example of how I would delete a row in mysql with Zend framework when I have two conditions? i.e: (trying to do this) "DELETE FROM messages WHERE message_id = 1 AND user_id = 2" My code (that is failing miserably looks like this) // is this our message? $condition = array( 'message_id = ' =>...

How to create the route with optional params? (ZF1.8)

The router $router->addRoute('catalogue', new Zend_Controller_Router_Route_Regex('(?:(uk|en)/)?catalogue/(.+)', array( 'language' => 'uk', 'module' => 'default', 'controller' => 'index', 'action' => 'catalogue' ), array(1 => 'language', 2 => 'param'), '%scatalogue/%s' )); When ...

Problem with inet_pton() call within Zend framework

Hello everyone, I have a problem with using Zend framework (for YouTube data API). I created very simple PHP script for uploading YT videos using this API and it works almost everywhere - I tried it on 3 different machines (both Linux and WinXP). But after intalling it to 4th machine, I got this error: Error: inet_pton() [function.inet...