by
faheem on October 31st, 2010
It ages since my last contribution on Zend Framework. I was too busy during all this time and believe me things have been changed a lot. I am doing MSIT from one of the top university of Pakistan and it makes me proud studying in such a competitive environment and learning from top faculty. Although it’s tough environment and I often complain about the work burden but one cannot learn until work hard.
Now let’s come to the point. Apart from getting admission in NUST I am working with new client. The best part is that after waiting for one year I got the opportunity to work in my favourate Zend Framework. In addition to Zend Framework I started working in new javascript library ExtJs. Before working in ExtJs I had worked in prototype and jquery and my view was that jquery is the best, but this ExtJs experience has changed my thanking and now I feel that ExtJs is way ahead of all Javascript libraries. The default theme of Extjs is cool and you can have Ajax functionality way easier than any other scripting language.
If you want cool layout with amazing functionality like data pickers, grids, forms and may more choose ExtJs, you will be shocked to see how easy it is to get these things.
Custom themes can be easily implemented if you don’t like the default theme. In my current project I’m using Zend framework at the backend and ExtJs at front end. I was in love with Zend, and no doubt I adore ExtJs now.
Our networking teacher always says let’s see inside the box as we have given lots of tries to thinking out of the box. So here I too will say, let’s see inside the box and explore what Zend and ExtJs offers us.
I hopefully will write some articles on how to use ExtJs and Zend together.
by
faheem on February 13th, 2010
You may have heard about FPDF, TCPDF. These are used to generate PDF document in PHP. But very few of you may have heard about LiveDocx, can be found here http://www.livedocx.com/. The most cool news I’m going to tell you that Zend Framework 1.10.0 provides clean and simple interface to LiveDocx API. LiveDocx is soap based service. If you are interested more in LiveDocx, following the link I’ve already provided you.
In this article I am gonna tell you how to create word processing documents and PDF using Zend_Service_LiveDocx. I am sure you will find it very helpful.
You can create you desired document by following these two steps.
1) Create template file
2) Fetch records from your database, as you usually do and assigned them to the template.
1) Creating template file
You can create your template file using Microsoft Word, openOffice and save then as .doc or docx or .rtf format. Keep in mind that creating template file in MS Word and openOffice may differ. In my example I am using Microsoft Word.
Open Microsoft word and create new document.
by
faheem on February 1st, 2010
10 minutes ago I downloaded Zend Framework’s latest version 1.10.0. I was using 1.7.8 for developing open source bug tracking application.
I was already aware of the change made to autoloader, but I didn’t make auotloader work for me in the first attempt. I was unable to load my models and forms.
I was using the following code for autoloading my models, forms and zend framework components.
require_once "Zend/Loader.php";
Zend_Loader::registerAutoload();
and then setting my include path as
set_include_path(
APPLICATION_PATH . '../../../library'
. PATH_SEPARATOR . APPLICATION_PATH . '/../application/models'
. PATH_SEPARATOR . APPLICATION_PATH . '/../application/forms'
. PATH_SEPARATOR . get_include_path()
);
When I replace loader code with the following code
require_once "Zend/Loader/Autoloader.php";
$autoloader = Zend_Loader_Autoloader::getInstance();
I encounter an exception saying that loader is unable to load my models. Googling for a bit of time I found the solution.
Actually Zend_Loader_Autoloader is a namespace-based autoloader. By default, it only registers the Zend_ and ZendX_ namespaces.
so it won’t load classes from your own directories.
To force loader to load your classes you will need to write the following statement right after the initialization of your loader.
$autoloader->setFallbackAutoloader(true);
Including this statment will not only load your model, but also pear packages if used in your code. I wonder you wont be able to use pear packages without writting this statement.
Another exception that I wasn’t expecting was file decorator exception. I’m using Zend_From_File for uplaoding files. As soon as I browse my page using Zend_From_File component, i was told that i am not uisng file decorator, I was setting decorator to my file element as
$file1->setDecorators(array(
'viewHelper',
array('Description', array('tag'=>'', 'escape'=>false)),
array(array('data'=>'HtmlTag'),
array('tag'=>'td', 'valign'=>'top', 'style'=> 'background-color:#ffffff;text-align:left')),
array('Label', array('tag'=>'td')),
array(array('row'=>'HtmlTag'), array('tag'=>'tr'))
));
After googling my issue I found that I will need to enclude Zend_Form_Decorator_File with file elements. The changes I made are
$file1->setDecorators(array(
'File',
array('Description', array('tag'=>'', 'escape'=>false)),
array(array('data'=>'HtmlTag'),
array('tag'=>'td', 'valign'=>'top', 'style'=> 'background-color:#ffffff;text-align:left')),
array('Label', array('tag'=>'td')),
array(array('row'=>'HtmlTag'), array('tag'=>'tr'))
));
By comparing the codes above you will find that I have only replaced “viewHelper” with “File”.