zend-framework

Removing parameters from URL when using Url view helper links

When using the Url view helper to build links, if the current page has parameters in the url, the url generated by the Url view helper will contains parameters as well. For instance in the page /controller/action/param/value/ the following code: <a href="<?php echo $this->url(array( 'controller' => 'index', 'action' => 'index' ...

Zend Framework "under maintenance" page

I'm trying to figure out how to set up a holding/"under maintenance" page in Zend Framework for when I am upgrading the database or something and don't want anyone using the site. I'd like to have a static HTML page and have all traffic redirected to that. I'd rather not use .htaccess and would like to do it via the bootstrap file. Any...

RSS Feed created using Zend_Feed - firefox prompts to download not display as RSS

I've created an RSS feed using Zend_Feed. It seems to have worked in that the resulting XML looks good. My problem is that Firefox won't recognise it as an RSS feed and instead prompts me to download the raw XML. Trying it in IE gives the error "this feed contains code errors" with the following extra info: Invalid xml declaration. ...

How should I structure my tree of resources in an ACL?

Hi All. Using PHP and Zend_ACL, I want to create an extremely flexible permissions system. I want to be able to assign permissions to all objects of a certain type, as well as to instances of those objects. If a specific instance of an object is queried and it doesn't exist in the resource tree then the permission set for the 'generic' o...

counting mysql query

Hi, I have the following code $result = $handle->select()->from('store_products_id', array('count'=>'COUNT(store_products_id.product_id)')) ->where('store_products_id.store_id=?', $this->store_id) ->columns($selectColumns) ...

Zend auth and redirection in Controller plugin

I have simple front controller plugin which contains this code: http://pastebin.com/m155c59b0 When session expire if user is on /admin/controller_name it will be redirected to auth module but if user is on /admin/controller_name/action_name it wouldn't be redirected, he will get error from error controller with message that action doesn...

How to create an SaaS Application?

I don't know how else to say it so I'm just going to explain my ideal scenario and hopefully you can explain to me how to implement it... I'm creating an application with the Zend Framework that will be hosted with DreamHost. The application will be hosted on its own domain (i.e. example-app.com). Basically, a user should be able to sig...

Outputting image using php GD library via function call

I know that I can output an image using GD by using <img src='draw.php'> Where draw.php is a file containing the code to create an image. How can I instead output the image via a function call (I am using the Zend Framework so will be using a View Helper) rather than simply pointing to a .php file in an img tag as above? Any help g...

Zend_Form and OOP design patterns

What is right way when using Zend_Form to create concrete application forms 1) Using "extends" and derived class class MyForm extends Zend_Form { public function __construct() { $el = $this->createElement('text', 'el'); $this->addElement($el); // ... } } 2) Or using delegation/proxy pattern class MyForm { private $_form;...

Dealing with dates and timezones, with Zend_Date

I have an application which uses Zend_Date to display dates. Zend_Date instances are created using datetime data from MySQL, user input and the current date. I would like for my users to be able to specify their timezone and for all dates to be displayed in their local time. At the moment my code works like this: $date = '2009-01-01 1...

How to swap product image that is already in cart depending on selected product option?

Hi everyone, recently I was needed to enhance Magento (1.3.1) user interface. Particularly add a product image switcher (following http://inchoo.net/ecommerce/magento/create-a-color-switcher-in-magento/). The results: - image switcher works as expected, which is fine. The problem: - The product itself could hold as much as 15 or 20 col...

Zend_Form_Element_File - file gets lost when form errors

I'm creating a Zend Form which includes a Zend Form Element File to allow the user to upload a file. When there is an error on the form (i.e. validation fails), when it is re-displayed for the user to correct, the file upload box is empty (so they have to click browse and select it again). Is it possible to get it to save the file? ...

Zend organization question

Hi guys, So I had a question on general organization of code for the Zend framework with regard to the layout. My layout is basically this: (LAYOUT.PHTML) <div id='header'> <?= $this->Layout()->header ?> </div> <div id='main'> <?= $this->Layout()->main ?> </div> <div id='footer'> <?= $this->Layout()->footer ?> </div> and so on an...

Zend DB Framework examine query for an update

So you can use something like this: $query = $db->select(); $query->from('pages', array('url')); echo $query->__toString(); to examine the sql that the Zend Db Framework is going to use for that SELECT query. Is there an equivilent way to view the SQL for an update? $data = array( 'content' => stripslashes(htmlspecialchars_de...

Where should My_Validate_PasswordConfirmation put in Zend framework?

I am using the password confirmation validator from the official Zend framwork document here: http://framework.zend.com/manual/en/zend.form.elements.html In Bootstrap.php, I have set the namespace as 'namespace' => 'My_' The file is located at application/validate/PasswordConfirmation.php However, "Fatal error: Class 'My_Validate_Pass...

Zend Framework headMeta() - keywords not appending

Hi, I'm using Zend Framework 1.8. I have a problem with headMeta() duplicating my meta keywords. In my layout.phtml, I have <?php echo $this->headMeta(); ?> I have a Custom Controller_Plugin_ViewSetup (extending Zend_Controller_Plugin_Abstract) that has the following code in it, in the dispatchLoopStartup() function: $view->h...

In Zend framework, where should I put the custom validator?

I put the class under application\validate\PasswordConfirmation.php And it doesn't work. Error Class 'Default_Validate_PasswordConfirmation' not found still occurs. Does anyone have this problem before? ...

Why can't I override the default validation error message?

Hi all, I'm using Zend_Validate to validate some form input (Zend Framework version is 1.8.2). For some reason, using the Zend_Filter_Input interface as described here does not work: $data = $_POST; $filters = array('*' => array('StringTrim')); $validators = array('driverName' => array('NotEmpty','messages' => 'This should override the...

Difficulties when learning Zend Framework 1.8

I am a newbie of Zend Framework. I downloaded the Zend Framework and then followed the official quickstart tutorial to build a very simple registration form. But after that, I find very hard to learn different elements of Zend Framework. Many tutorials mention frontController and registerAutoload() in the bootstrap file. However, it se...

How to use different bootstraping for different modules in zend framework

I have two modules, default and mojo. After the initial bootstraping code which is the same for both of the modules, I want, for example, to use different layouts for each module (Or use different credentials check etc). Where do I put this: IF(module=='mojo') do this ELSE do that ...