All,
For an intranet application we run Drupal 6 but we also have a CakePHP
application for back-office stuff. A simple example is employee
directory. The CakePHP application is read-write with group-based
access control.
We'd like some of the CakePHP information to show up in Drupal on a
read-only basis. I had written a few cheap scripts placed in nodes
that query the Cake-side tables directly, but I don't see this as
ideal. For one, I want to move toward building more formal Drupal
modules and avoid simply putting random PHP code in nodes (where I see
the code being traversed by the Drupal search indexer!). It would
also be hard to maintain over time.
I have the notion of writing a very basic Drupal module that does
nothing more than provide a single interface to our CakePHP tables,
then I could add modules like "Department_Directory" that would use
the base module. Where I'm getting bogged down now is how best to
connect to the CakePHP tables. I think I have seen most of the Drupal
and CakePHP docs on connecting to multiple databases (no problem) and
I have also looked at modules like Drake (not what I want).
What I am struggling with is whether there is a way to create a
CakePHP component or helper that provides certain basics (like show
full name sorted in last name, first name format) but which I could
also reference from Drupal to provide the same function. I find
myself starting to add snippets like this to multiple controllers:
$person_orderby = array('Person.lastname', 'Person.firstname');
$people = $this->OfficeOccupancy->Person->find('list', array('order'
=> $person_orderby ));
to create pick lists/menus. This could get very laborious, so I am
trying to figure out how best to "component-ize" that kind of stuff.
Even better if I could figure out a way to make the same code/routines
work for Cake *and* Drupal.
One thought I had was to have a completely separate controller
component that would house all of these basic lookup functions and
then write some very simple (unformatted? HTML-less?) views that
Drupal could reference to pull result sets back into my Drupal "data"
module.
Anyhow, sorry for ramble. Any thoughts appreciated. I suppose I
could write a library of functions that just connect to our CakePHP
tables, but I thought it could be worthwhile to think it through a bit
more.
Jim
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en