views:

93

answers:

2

We are developing a new site in Zend Framework while we maintain and improve our older version (plain old fashion PHP files).

This in some cases is meaning waisting hours of programming that we could to some extend use for our newer versions.

We do have full server control and a sophisticated 301 rewrites on Apache, so we could rewrite o symlink as required. Our aim would be to be able to include Zend in a subdirectory of our site so we can at least use its libraries on any PHP programming and even better that the DB models and as much code as possible could be reused afterwards on our purely ZF site when its finished.

Would this be worth the hassle? Can someone point at a tutorial or best practices in order to do this?

Many thanks.

+2  A: 

It's entirely possible to write ZF-based pages one at a time for new functionality, or to replace old parts of the site.

You pretty much write new pages as required, but rather than feeding through index.php, as normal, you you mod_rewrite to direct specific URLS to a new zf-based page:

RewriteEngine on
RewriteBase /
# Not if there is a file or directory that matches
RewriteCond %{REQUEST_FILENAME}       !-f
RewriteCond %{REQUEST_FILENAME}       !-d

# a new, clean URL can go to an old page
RewriteRule ^online /online_now.php

# other pages go to a ZF-frontcontroller, in zf.php
RewriteRule ^about/ /zf.php           [L]
RewriteRule ^account /zf.php          [L]
RewriteRule ^data /zf.php             [L]
RewriteRule ^faq /zf.php             [L]
Alister Bulman
+1  A: 

We have a fairly heavily modularized site, so our tactic for this is to start by developing new modules with Zend Framework. We use .htaccess pretty heavily already (much too heavily, in fact) so the last rule in ours is just a redirect to the Zend controlled areas.

We revisit old modules with a small amount of regularity, and as we need to rework them in significant ways we'll rewrite them.

The hardest part, which wasn't actually very hard, was ensuring all of our session information stayed consistent in the different pieces.

Actually, the hardest part is probably ensuring that the interface is somewhat consistent. There's so much terrible code in the old part of the system (bits of which are 10 years old) that we've had to break Zend Framework conventions in small ways here and there to make it transparent to the users.

This is pretty experimental for us. We have new systems implemented on Zend Framework so have a fair bit of institutional familiarity with it, but couldn't convince ourselves that a rewrite for the legacy system was worthwhile. We're in the very early stages, but feeling pretty positive about it.

Rob Drimmie