Include Jquery in Zend Framework 1 using ZendX

As many of you know – ZendX stands for “Zend Framework – Extras Library”. They were introduced since Zend Framework version 1.7 and is here to help us implement alternatives to already existing solutions. I am a big fan of jQuery and therefore will explain how to include ZendX library and start using jQuery with Zend Framework – the right way.

Even though adding jquery can be done in the layout manually using appendScript, adding through ZendX library will be appropriate and in Zend way.

Step 1: ZendX Library

  • download Zend Framework
  • extract it and search for ZendX in folder library (usually it will be library folder)
  • copy the whole ZendX folder to your projects library so that you get library/ZendX

Step 2: Bootstrap

Now that we have set ZendX library into our project – we should initialize it on Bootstrap in method _initViewHelpers. So your bootstrap _initViewHelpers function will look like following:

Step 3: Finally

You can see that I have included jquery and jquery-ui in the bootstrap itself. So, the final step is just add this in your layout. Include the following line in the head part of your layout.

This should be the all you need to start using ZendX with jQuery in your Zend Framework project.

I have been developing websites & web applications since 2004 and currently working in London as full-stack Senior Web Developer. I utilize and advocate in the layout, design and coding of websites specifically in PHP format. Experienced in developing applications and solutions for a wide range of corporate, charity and public sector clients and having the enthusiasm and ambition to complete projects to the highest standard. My ulitmate focus is on server side programming, release process, automation, and standards based web site & applications especially on Zend Framework. I also have a keen interest in developing Wordpress plugins and contributing to open source projects.

2 thoughts on “Include Jquery in Zend Framework 1 using ZendX

Leave a Reply to admin Cancel reply

Your e-mail address will not be published. Required fields are marked *