You are here:Home arrow Zend Framework & PHP
  • Narrow screen resolution
  • Wide screen resolution
  • Decrease font size
  • Default font size
  • Increase font size
  • default color
  • green color
  • blue color

Zend Framework

Our contributions to Zend Framework community. We use Zend Framework alot in our every day projects. Read on for some helpful tips and optimization practices for the best PHP development framework of the present.

Serving XHTML in Zend Framework App

Serving XHTML is often misunderstood by php developers. Frontend engineers simply include the XHTML doctype to their documents, without actually serving document as XHTML. This triggers majority of the browsers to treat such pages as 'tag-soup'.

If you really care for faster XHTML rendering, you can get its benefit by using content negotiation, thanks to the new controller plugin we have for you.

You should note, however, that your pages should be xhtml compliant and validate against XHTML validators like the one at validator.w3.org. Otherwise supporting browsers will display errors without no real content shown to users! If you are sure that your frontend designer is a good xhtml writer, then you should be safe (still, it never hurts to validate first).

Enable your Zend Framework App with Conditional GET! (Make it green)

In this article I'll show you a simple approach to enable your Zend Framework application saving lots of precious bandwidth, and thus, making it more end-users friendly, and save on bandwidth costs.

This technique involves HTTP conditional GET. This is basically a feature of the HTTP protocol. By sending correct HTTP headers with your application, you enable browsers of your end users to cache pages of your site.

Are you worried about users having old versions of page in cache? Then don't! This technique allows to get all the benefits of client side caching without affecting anything but 5 minutes of your time to integrate it :).

Database aware Select elements for Zend_Form (or Extending Zend_Form_Element_Multi)

In this article, you will know how you can extend select form element that comes with Zend Framework, to be easily filled with data from your database table. We want to be able to easily fill select elements from database table with less repetitive code. It's already easy to fill select elements with database data out of the box:

$db = Zend_Db_Table_Abstract::getDefaultAdapter();
$options = $db->fetchPairs(
   $db->select()->from('table_name', array('id', 'display_field'))
     ->order('some_field ASC'), 'id');
$form->getElement('someelement')->AddMultiOptions($options);

In the snippet above you get default database adapter, then simply fetch all items from 'table_name' ordering by 'some_field', and you see we fetch them as pairs binding to 'id' field. This basically means that the result of fetchPairs returns associative array of items. For select control options, we just want two fields: one for the display and one for the values ('id' is the value field, 'display_field' is for display)

But what if you have many database aware select controls? How is it possible to extend Zend Framework select elements with an easy method to populate data from database table?

Read on for details.

Zend_Form double escaping

Sometimes you might notice that with Zend Form you have quotes double escaped. This is because Zend_Form escapes your input, and so does a php binary. You really want to disable it in this case. Head on to your .htaccess and add: php_value magic_quotes_gpc off

Debugging your ZF application with Firebug

Debugging your application using Firebug can be a handy substitute for using Zend_Debug::dump (). In this tutorial we are going to show you, how you can create an action helper for dumping your php variables to Firebug's console.
<< Start < Prev 1 2 Next > End >>
Results 10 - 14 of 14