Drake (Drupal + CakePHP) is making progress
Posted on 25/1/06 by Felix Geisendörfer
Deprecated post
The authors of this post have marked it as deprecated. This means the information displayed is most likely outdated, inaccurate, boring or a combination of all three.
Policy: We never delete deprecated posts, but they are not listed in our categories or show up in the search anymore.
Comments: You can continue to leave comments on this post, but please consult Google or our search first if you want to get an answer ; ).
For all of you who have been looking at my proof of concept for joining the powers of CakePHP and Drupal there are good news: The project is coming along very nicely and I think within 1 or 2 weeks I'll be able to release the first Alpha version for public use.
So here are some of the things I've recently been working on:
Drupal Theme Integration
Well one of the first things I needed to work when I started this project was that my website could use a theme of drupal but use the rendered view of a controller to show up inside of it.
While this hasn't been to difficult there was something that recently started bugging me. It would be stupid if I couldn't use all the cool CakePHP stuff for views in my layouts now. Especially the lag of helpers was the one most important thing I'd miss. So ... how to fix this? Luckily Drupal has build-in support for costum theming librariers (most notably smarty) so I started by making a copy of the standard engine phptemplate which basically just includes php files. Then I started modifying until the point where I could create a new View class which then would render all pages. Then I tried if it would work together with one of my themes, and ... it did! I didn't even have to make one change to it but I now I am able to use $html->link() etc. inside of my drupal themes now!
Drupal functions
Well while my setup allows me to use virtually any function of drupal I am writing a library which will ease the use of this with CakePHP. So you will have Models for all kind of drupal related data like the config, nodes, localization, etc.
Search Integration
Another thing that'll be in the package will be a handle for controller not found that will bring up the search function of drupal to the user. But the best thing: I want to have an Ajax autocomplete for it so it'll be really smothe to use ; ).
Now what do you want to see?
As the development is still in a very early stage I'm still trying to figure out what things should belong to the drake project. How do you want permission to be handled? ACL's or Drupal's Right managment? What other stuff are you interested in? Let me know and I'll try to integrate as much as possible of the idea's I like ^^.
--Felix
PS: Sorry about the fact that I've not updated this blog for a while, I didn't have time for devin' and even less for bloging the last couple days. I'll try to get better about it ^^.
You can skip to the end and add a comment.
[...] Felix of thinkingPHP has been making progress with (Drupal + Cakephp)= drake which is one of the most important combination as far as using cakephp framework. [...]
Hey richard,
I'm glad to hear somebody is using the code I've written, in fact I think your the first one.
Right now the project is only laying around on my computer and I mostly talk about it
in #cakephp on chat.freenode.net, but I intend to make it more open & available to public
as soon as it hits alpha status.
Concerning the rights managment. I think I'd have to get real tricky about it if I want to use the one supported by drupal since it's based on functions in actual files (modules). But either code generation or dynamic function creation should be a possibilty so ^^ ... ACL will definitly supported I think.
As for now I'd really like to get in touch with you because i'd be really happy to have someone test my code and give me feedback on it. I'm available over ICQ (124-330-907), Mail (FelixGe[at]web[dot]de) or you can catch me hanging around on IRC.
Oh and before I forget, my name on #cakephp is "the_undefined". So you know if I'm online.
hi Felix,
Surely you can count on me and i'd be willing to participate. I'll probably help on other implementation and or drake improvements in a few weeks from now. Let me know some of your plans and will keep track on it. For the meantime i have to gather more info about drupal and your drake ...
Do you have ym? i'm always online although we are quite far Lol " i'm here at Standard Time +0800 UTC", I am seldom on IRC. :)
Good luck
A big thing that people forget about is multilingual issues.
Don't forget about that - the world isn't all english-centric.
Support double-byte...
Lawrence / www.shanghaiguide.com
Hey Lawrence,
I'm not sure what you mean? One of the big reasons I started to base my CakePHP apps on Drupal is that drupal has excellent multi-language support build in which I am now able to use from within CakePHP. Or was your comment supposed to be a positive one for that reason?
Terrific Blog you have. Peace Out.
TreeFrog
Kewl blog you got goin on up here.
Peace, JiggyWittit
Hi Felix
This is great work, and I believe it is exactly what I have been searching for to reduce my work load. I have no desire to build all of the functionality that Drupal offers. Drake sounds like the future for me.
I will be giving it a whirl very soon.
Regards,
Langdon
Hi Felix
I have tried out Drake and has some problems. I have posted details in the Tutorial page. If you have a chance to look at it I would be greatful for any input you can give me.
Regards,
Langdon
Very nice site!
Hi ! Your site is very interesting. Thank you.
In case someone is interested, you can also call drupal functionality from an external php script (CakePHP or otherwise) using Drupal's module_invoke function. So you can run drupal on part of your site, separate from your custom code, and reach into drupal only when needed. For example, the following will grab the thumbnail from content "node" #42 in drupal which you might want in your custom site to create a seamless link.
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$thumbnail = module_invoke('image','display', node_load(42), 'thumbnail');
Hey Jeff, good stuff, thanks for sharing! ; )
Have someone considered binding a Cake application into Drupal as a module? The idea would be that the content from the Cake application appears as a Content Node in Drupal. The benefit would be that menus and other features of Drupal remain the same. - Torbjörn
Torbjörn: That's kind of what Drake is ment to do. But then again, there are different ways of doing this.
I've experimented with this drake implementation for the last couple of days and have been very impresed with its simplicity. I have it working multi-site drupal.
I would like to see cake ACL make use of drupal taxonomy_access. A drupal user would setup 'Access Control Objects' acos using taxonomy_access in drupal and Cake would use drupals 'users', 'term_access' and 'term_access_default' tables for 'Access Request Objects 'acrs'.
I was also able to get drake to use multiple databases, add function drake_connection in drake.module
example of the setting.php I have a second db
'mysql',
'connect' => 'drupal_connection',
..................................
var \$posts = array('driver' => 'mysql',
'connect' => 'drake_connection',
.....................
?>
Posts Model uses the second database
models/posts.php
function &drake_connection($server, $username, $password) {
$new_link = true;
$dbConnection = mysql_connect($server, $username, $password, $new_link);
if ( ! $dbConnection ) {
die('could not connect to DB '.$server. $username . mysql_error());
}
return $dbConnection;
}
example of the setting.php I have a second db
eval("class DATABASE_CONFIG
{
var \$default = array('driver' => 'mysql',
'connect' => 'drupal_connection',
..................................
var \$posts = array('driver' => 'mysql',
'connect' => 'drake_connection',
.....................
Posts Model uses the second database
models/posts.php
class Post extends AppModel
{
var $name = 'Post';
var $useDbConfig = 'posts'; // cannot get it to use another DB
Hi Felix,
I cannot get drupal and cakephp working together. I am using their latest versions.
Regards
Vijay
I checked out the drake tutorial and walked through it. There are a few things that need to be added for the manual tutorial to work that I got stumped on. First off the drupal_module.zip does not include the drake-config.php or database.sql files to put into the /drake folder. The drake.module file also does not have the use_drupal_layout() function needed to work. I had to download the drake_sample.zip to figure out about the files mentioned above and to copy over the correct version of drake.module that would work. So everything is up and running now. I just wanted to let you know. Thanks for a great addition to drupal and cake.
Jeremy
Few days back, I was thinking about merging CakePHP and Joomla, it has given me even more confidence to start my project now ;)
Hey Felix,
What's up! Weird to see you outside of CakePHP google group ;)
Have a question, what's the status of this project? Can I extend it?
Using the same procedures I used for building Jake (following Max's work, now available at http://dev.sypad.com/projects/jake) I just built a module for Drupal 5.1 that:
1. Same as Jake, allows your CakePHP application to run with or without Drupal, with no code modifications at either end.
2. Handles the possibility that Drupal & CakePHP may be using different databases.
3. Properly manages sessions (since Drupal may use a session handler that is not the same as Cake, plus Cake brings by default the AUTO_SESSION which would make your Cake application to complain when running inside Drupal): sessions are closed before running the application and restored afterwards, so your CakePHP application can use sessions at will, and Drupal doesn't loose its session information.
4. No need to change any links or anything in your CakePHP application, the module automatically makes every link/AJAX resource to go through Drupal (*if* the CakePHP application is running on Drupal in the first place)
Well and a lot more things, so I was wondering how we can combine efforts.
Thanks mate! :)
Hey Mariano: Sounds awesome! I'm not really playing around with drupal any more these days, but I would welcome you to use the name 'Drake' for your project. Reminds me there is something I wanted to talk with you about anyway (PayPal stuff), so let me send you an email ... ; ).
[...] March 1st, 2007 This is my second post about Drake which is a combination of Drupal + CakePHP = Drake. I’ve used Drake few days after Felix of thinkingphp.org released it to the public as part of his proof of concept, it was very experimental during that time where in fact CakePHP wasn’t in its stable stage but Drupal was very stable, knowing CakePHP’s core gave me confidence to use Drake in my own production project and it went pretty well, there were some minor glitches but not a show stopper in production. [...]
This post is too old. We do not allow comments here anymore in order to fight spam. If you have real feedback or questions for the post, please contact us.
Hi Felix,
I'm currently using your Drupal + Cake = drake on one of my production environment , i call it production because i just recently transfered all my pure cake implementation into drake. So far it gives me a little bit confident on using it because i needed a very nice pre-built template system so that i can concentrate on pure development and leave the others to the designers..
I'm just new to drupal so i cannot comment on which permission system will be used but i would suggest let the developer choose between the two , ACL or drupal's RM. I guess for me, that would be great so others could utilize the ACL's capability while at the same time using drake.
BTW, where can i get the activities of drake? is it hosted at cakeforge? because in the long run i'll probably be using darke and in that way i can give you feedbacks, bugs and other suggestions. :). Let me know :)
good job! More power.
happy baking
./richard