Hi Josh,

No, no symlinks, and no routing.

For the config, I've defined the CONFIGS constant that cake later uses
to find out the path of the config file.
For the models, I've used the very convenient "Additional Cake
Paths" : http://book.cakephp.org/view/36/Additional-Class-Paths

Basically, the main thing is to edit the index.php of each app so that
they look the following (assuming that the we are using the directory
structure I posted in my previous email) :

File : /myserver/www/mysubapp/index.php :

/**
 * The full path to the directory which holds "app", WITHOUT a
trailing DS.
 *
 */
        if (!defined('ROOT')) {
                define('ROOT', 
dirname(dirname(dirname(__FILE__))).DS.'subapps');       //
Translates "/myserver/www/mysubapp/index.php" to "/myserver/subapps"
        }
/**
 * The actual directory name for the "app".
 *
 */
        if (!defined('APP_DIR')) {
                define('APP_DIR', basename(dirname(__FILE__))); // Translates: 
"/
myserver/www/mysubapp/index.php" to "mysubapp"
        }

/**
 * The absolute path to the directory containing shared classes
between all apps, WITHOUT a trailing DS.
 *
 */
        if (!defined('SHARED_DIR')) {
                define('SHARED_DIR', dirname(dirname(dirname
(__FILE__))).DS.'shared'.DS.'myapp'); // Translates: "/myserver/www/
mysubapp/index.php" to "/myserver/shared/myapp"
        }

        define('CONFIGS', SHARED_DIR.DS.'config'.DS);   // Path to the shared
config directory. Defining it here prevents it from being later
defined by cake to point at at the standard location



Note the SHARED_DIR, wich is my define, not CakePHP's. We will use it
later.

Then, in /myserver/shared/myapp/config/bootstrap.php, I've added :

        $modelPaths       = array(SHARED_DIR.DS.'models'.DS);
        $viewPaths        = array(SHARED_DIR.DS.'views'.DS);
        $controllerPaths  = array(SHARED_DIR.DS.'controller'.DS);
        $helperPaths      = array();
        $componentPaths   = array();
        $behaviorPaths    = array(SHARED_DIR.DS.'models'.DS.'behaviors'.DS);
        $pluginPaths      = array();
        $vendorPaths      = array();
        $localePaths      = array();

        Configure::buildPaths(compact('modelPaths', 'viewPaths',
'controllerPaths', 'helperPaths', 'componentPaths', 'behaviorPaths',
'pluginPaths', 'vendorPaths', 'localePaths'));

Hope this helps ! It works great for me.

On Jan 21, 5:12 am, Joel <[email protected]> wrote:
> Hi Greg,
>
> How have setup your sub apps so they cake can find the config and the
> models?  Are you using symbolic links or something?
>
> I'm guessing you're not using the prefix routing to handle this?
>
> Thanks,
>
> -Joel
>
> On Jan 21, 3:46 am, "Greg S." <[email protected]> wrote:
>
>
>
> > Hi Joel,
>
> > I'm experiencing the exact same problem right now.
>
> > I've decided to split my app into several sub apps, sharing the same
> > core, the same config files, and the same models.
>
> > My directory structure looks like :
>
> > -subapps
> > --admin  <-- each of those is a CakePHP app folder
> > --mobile
> > --web
> > --webservices
>
> > -shared
> > --cakephp <--cake core and vendors goes here
> > --myapp  <-- shared config and models for all the sub apps
> > ---config
> > ---models
>
> > -www
> > --admin  <-- each of those is accessible as a subdomain,
> > --mobile <-- example : mobile.myapp.com
> > --web
> > --webservices
> > --shared <-- shared resources, like images, etc...
>
> > So far, this works quite well, but it has some drawbacks. It breaks
> > the cake bake console, for example, as it can't find the config files.
>
> > If anyone has suggestions on this topic, I'll be glad to take them.
>
> > Best,
>
> > Greg
>
> > On Jan 20, 5:06 am, Joel <[email protected]> wrote:
>
> > > Hi,
>
> > > I've used CakePHP for a few reasonably simple projects, but now I'm
> > > about to start work on a project which is a bit more complicated.
> > > This project is going to have 4 different interfaces depending on the
> > > type of user. Ie Agent, Participant, Trainer and Admin.
>
> > > Previously I have used the admin feature of CakePHP, which worked
> > > great when there was the public site and the admin site.  But now with
> > > 4 separate sites, but with significant amounts of shared code, I'm not
> > > sure what the best way to layout the project is?
>
> > > For example all of the portals will share the same model, but each
> > > portal will have varying degrees of access to the data.
>
> > > At work we use Java a lot, and if I was doing it in Java I'd probably
> > > use a Session Bean to handle all the shared business logic, but such
> > > concepts don't appear to directly exist in CakePHP.
>
> > > I see that cakephp has vendors and plugins, but I'm not sure if that
> > > is what they are meant for.  Plugins don't really seem to be the right
> > > thing, because they appear to be quite independent.
> > > But vendors also seem to be for encapsulated pieces of functionality.
>
> > > Has anyone had any experience with multiple portals sharing the same
> > > models and views (to some extent, maybe using Elements or something)?
>
> > > Thanks,
>
> > > -Joel

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

Reply via email to