Yeah he's got it, the modelPaths variable in bootstrap is what you'll want to use.
On Oct 11, 2:36 pm, kanian <[EMAIL PROTECTED]> wrote: > On Oct 11, 9:04 pm, Tulio Faria <[EMAIL PROTECTED]> wrote: > > > I mean using the same model files.... :) > > > On 11 out, 11:01, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > > in config/database.php add > > > > var $'shared_db = array( > > > 'driver' => 'mysql', > > > .................................... > > > ); > > > > In all such model add > > > var $useDbConfig = 'shared_db'; > > Hi Tulio. > If what you mean is: > * that you'll have more than one application using the same model > files, the models that are supposed to reside in your application > folder, > then let's consider that your models folder is at the root of you www > folder (i'm using wamp and my cake install is inside a the cake folder > of www. I call the cake folder ROOT from now on) : > > 1. case one: you are not using mod_rewrite nor .htaccess files. > www > | > models. > | > ROOT > | > app1 > | > app2 > | > CAKE_CORE > > Here ROOT means the cake installation directory, which is by default > cake. Then the solution is to write in app1/bootstrap.php and app2/ > bootstrap.php the following line: > $modelPaths = array(dirname(ROOT).DS . 'models'.DS); > > Now you still have a problem: in cake/index.php you define your app > folder. So at any point of time using this configuration you can > access only one of your application, eventhough they all use the > models defined in the models folder. > Thus the solution seems imcomplete. One idea would be to have as many > cake install as you have applications: > > www > | > models. > | > ROOT1 > | > app1 > | > CAKE_CORE > ROOT2 > | > app2 > | > CAKE_CORE > > This way you just have to write, in your > browser:http://mysite/cakeApp1/controller/action > and the same models will be used. > Now with this config, you are using the same CAKE_CORE twice, to solve > this redudancy CakePHP will let you specify a CAKE_CORE outside the > ROOT directory: > > (line 43 of ROOT/index.php) > //define ('CAKE_CORE_INCLUDE_PATH', FULL PATH TO DIRECTORY WHERE CAKE > CORE IS INSTALLED DO NOT ADD A TRAILING DIRECTORY SEPARATOR'; > > So leave this line commented and simply rewrite the line 44: > define('CAKE_CORE_INCLUDE_PATH', dirname(ROOT)); > > So now we put the CAKE_CORE outside of ROOT so that all of your apps > can use the same CAKE_CORE: > > www > | > models > | > CAKE_CORE > | > ROOT1 > | > app1 > > ROOT2 > | > app2 > > 2. in case you are using mod_rewrite and .htaccess files: > put your file structure as indicated in the solutoin I just > mentionned: > > www > | > models > | > CAKE_CORE > | > ROOT1 > | > app1 > > ROOT2 > | > app2 > > and rewrite line 56 of app1/webroot/index.php and app2/webroot/ > index.php, etc, as: > > define('CAKE_CORE_INCLUDE_PATH', > dirname(dirname(dirname(dirname(__FILE__))))); > > Hope this can work for you. I tried sharing the models this way and it > worked. I haven't tried the CAKE_CORE sharing though ;-), but don't > worry, it should work the way the CakepHP team says it will. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---
