On 27 February 2012 08:50, Stephen <stephen@ninjacodermonkey.co.uk> wrote:
Apologies, I didn't explain properly... I was on the train!
Step 1
I followed the nuts and bolts "Run multiple apps side-by-side" tutorial, this meant that I could use one shared cake folder between app folders (Not that it's really important to achieve what you want).
From here by accessing www.website1.dev and www.website2.dev it would access either the app folder "website1" or "website2".
Step 2
I decided that any functionality unique to the client will be placed in the application and anything I think would be shared between applications would be placed in a plugin. The plugin has its own database connection and handles things such as categories, products etc.
Step 3
I could then access the same method from both applications by going to website1.dev/admin/pluginname/pluginname_categories/index or website2.dev/admin/pluginname/pluginname_categories/index
Step 4
This is the trickier one, I've created 2 controllers / models in my plugin "pluginname_clients" and "pluginname_client_hosts".
I place each client as a new record in the database (i.e. INSERT INTO `pluginname_clients` VALUES (NULL, 1, 'Website 1', NOW(), NOW()). (Website 1 (ID1), Website 2 (ID2))
I then place each known host and ip address in `pluginname_client_hosts` and state `pluginname_client_id` as 1 or 2.
Step 5
From here I could detect which client is accessing the plugin by their host and have the plugin adjust itself accordingly, one thing that is a little bit of a pain - permissions for the client (i.e. category 12 should be available for clients A, B and C but not client D).
I wanted to create a config file for my plugin using Configure::load / Configure::read but I couldn't get it to work.
If anybody has a better way of doing this, I'm all ears.
HTH
Kind Regards
Stephen
http://www.ninjacodermonkey.co.uk
--
Kind Regards
Stephen
http://www.ninjacodermonkey.co.uk
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment