Hi everybody,

I really like drupal but I felt the way of writing modules for it was not very effective in my oppinion.
So recently I fell in love with another great project which is called CakePHP
which essentially is a PHP Framework for writing websites which is making heavy use of the MVC pattern which
eases creating very clean, readable and reusable code. So my I had the idea of putting them both together which
I ended up doing by writing a little drupal module which would redirect every page_not_found site to CakePHP which
would then give back the actual site. This has the advantage that you don't have to register path and all this stuff
in order to make your functions work, but you can also make use of the great amount of Ruby on Rails like Html
Helpers and there is cool AJAX stuff coming with it as well.

So in case anybody is interested in this technology I wrote a little tutorial on how to do it yourself and also put up 2 little
Cake examples, one doing Ruby on Rails like scaffolding, the other one is a Ajax driven autocompleting search.

Here it is:
http://drake.kdz-online.de/drake/tutorial

Bye, Felix

Comments

eaton’s picture

Although it's not really accurate to say that this involves making Drupal modules. It's more about how to redirect Drupal 404's to a different web app altogether.

--
Jeff Eaton | I heart Drupal.

--
Eaton — Partner at Autogram

the_undefined’s picture

You are right, but that is the base of extending drupal in different ways. I just called it "creating drupal modules" because that would put it in the most meaningfull manner for people who want to know what to do with it.

But it's not a redirect, it's an include. Because CakePHP will have access to all of drupals functions and variables the way this thing is that up.

Felix

Update: I just looked at your blog. I like it, nice work.

eaton’s picture

But it's not a redirect, it's an include. Because CakePHP will have access to all of drupals functions and variables the way this thing is that up.

Interesting -- I skimmedover it but didn't immediately get that part. I can see where it could be an interesting addition to the toolbox ... Have you looked at what impact it has on memory? I'd imagine it would be less attractive to high-traffic sites due to the overhead, but for smaller ones it could be useful...

--
Jeff Eaton | I heart Drupal.

--
Eaton — Partner at Autogram

the_undefined’s picture

I'll do some benchmarks on it soon, Comparing a drupal install without and one with CakePHP doing the same task.

My feeling tells me it should scale well with bigger sites. But of curse not as well as a pure drupal install would. CakePHP is fairly light weight.

I think you should look at it as I wrote on the site: We live in a time where CPU cycles are cheaper than the money you've got to spend on maintaining "performance optimized" but unreadable code.

Felix

the_undefined’s picture

If anybody is interested in reading more on this topic I currently run a weblog called "Thinking PHP" where I'll talk about using CakePHP and Drupal together (besides of using both of them alone as well) ...

Link to my "Webdesign CakePHP, Drupal and PHP Weblog"

prond’s picture

Hi I have tried putting together Drupal 5.0 and CakePHP.

I seems to work fine, however you may need to overload the SessionComponent just by making its __construnct($base = null) empty (doing nothing). Put the file in app/controllers/components/session.php so that no file from the core dir will be changed.

After that fix the app is working fine, I will write if something crashes.

mariano.iglesias’s picture

You may want to try the new Drake :: Drupal-CakePHP bridge:

http://dev.sypad.com/projects/drake

Or its home right here on drupal:

http://drupal.org/project/drake

No need to modify Drupal nor CakePHP source code, no need to force 404, a standard Drupal module that lets you execute your CakePHP applications inside Drupal without source code modifications.

Enjoy!