2007-10-29

Integration of Zend Framework and Prototype Ajax

Last two days I've worked on implementing an example of integration of Zend Framework's MVC and Prototype's Ajax for HTML Forms submission and validation.

The solution consist of 2 parts:

1. There is a new View Helper to create an Ajax-enabled form.

This part mostly consists of JavaScript code, which alters default HTML Form behavior to submit the input element values to the action's URL with Ajax, if form's method is set to 'ajax'.

In addition the form itself listens to submission result events and (by default) marks input elements if they are invalid.

2. There is a new customized abstract base Controller which replaces default ViewRenderer with a new one, which:

a) detects whether the request was received from Ajax.
b) if true, will not render the view, but instead will output with the input validation information, if either.

Well, the development is not really over yet, but what I originally wanted to say is I've just realized how I miss writing good old JS. :)

By the way, I need to repeat [ad:start] how happy I am to have PHP, HTML and JavaScript editors in one powerful standardized environment (Eclipse) - what I never had in the past, before PDT, WST & ATF came to the picture [ad:end] :)).

2007-10-21

PDT CodeDataResolver and ContentAssistSupport Unit Testing

Just wrote the subject related article here.

The article explains the concept of editor caret position based Unit Testing of editor links and code completion in PDT.

2007-10-20

Debug PHP and JavaScript simultaneously

Yesterday me and Roy had a brainstorm session on future Zend Neon (Commercial version of PDT) and ATF integration and "occidently" found a way of debugging of an URL with both Zend's PHPand Mozilla's JavaScript debuggers in one session.

Surprise! It's possible with neither patching nor hacking. I'm not going to show the exact steps of this, but the idea is very simple:

As you probably don't know, to debug URL on a server which has Zend Debugger installed it's enough to pass several simple parameters with the HTTP request (either in the query string or as cookies), like client IP and port, debug type etc., to start the debug session. Afterwards the debugger contacts the client machine, where a Neon's Debug Daemon listens for incoming connections. The Daemon then raises up a new Launch Configuration.

When Neon's Debug URL action is executed, it just appends the needed debug parameters to the passed URL and sends the updated URL either to the browser. Just grab this URL and start Mozilla JavaScript Debug Launch with it!

As the result 2 simultaneous launch configurations will start; the first activated session will be PHP's one and then, after the browser will start receiving content from the server, JavaScript's one will come into the picture.

Voila!

Moreover, if you enabled all-pages (cookie based) PHP debugging, it will go further with your AJAX (AJAH/AJAJ) requests!

Now the only problem :) is you cannot set breakpoints of both PHP and JavaScript types in the PHP source file, since it doesn't match the final responce which will be passed to the browser, so you should enable the option to suspend the JavaScript execution immediately after it starts to add breakpoints to the responce HTML source.

Version Upgrade

Today I found that the new version 7.10 of Kubuntu just released.

Since my only Linux machine is in the office and I'm at home today, I've started to upgrade the system via VNC. And now I'm wondering will it allow me also to finish with it. :)

Update: It's funny, but it didn't allow me to continue, since some of my old Third-Party Feisty repositories reported 404. Continuing the jorney...

Final: Well, the upgrade succeeded from the 3rd attempt. The system seems working a bit faster, probably because of KDE major upgrade.