I have read a post where Tulio Fara was asking help to settup many
applications to use the same models.
I want to share a solution for this issue and also find out if I'm
doing it the cake way :-).
Now I'm using wamp and I unpacked Cake inside the cake folder of the
www folder of wamp (the folder from which wamp serves pages by
default).

*First case: no mod_rewrite nor .htaccess files:
my directory structure is the following( some folders are omitted):
www
      |
      cake
            |
            app
                |
                models
            .
            .
            |
            cake

Now I want the models folder to reside somewhere and many apps to
access it.

www
      |
      models
      |
      cake
            |
            app
                |

            .
            .
            |
            cake

I put models under the www folder, and I write this line in app/
bootstrap.php:

$modelPaths = array(dirname(ROOT));

Now the thing is that only one app at a time will be able to use the
models because of line 33 of www/cake/index.php:

define('APP_DIR', 'app');

To solve this I will house each app in its own cake install:


www
      |
      models
      |
      cakeApp1
            |
            app1
            |
            cake
      |
      cakeApp2
            |
            app2
            |
            cake

To avoid the redundancy of using many CAKE_CORE folders , i mean the
'cake/cake' folder in the default Cake installation, I modify the
CAKE_CORE_INCLUDE_PATH as adviced by the CakePHP team at line 44 of
'app/bootstrap.php'.:

define('CAKE_CORE_INCLUDE_PATH', dirname(ROOT));

I Do this for as many apps as I have.
Then I set my directory structure as such:


www
      |
      models
      |
      cake
      |
      cakeApp1
            |
            app1

      |
      cakeApp2
            |
            app2

Second case: mod_rewrite is enabled and .htaccess files are used:
I use the same directory structure as above, I keep the same modifs to
all of my apps bootstrap.php files.
Then I simply change the line 56 of the webroot/index.php of each app
like this:

define('CAKE_CORE_INCLUDE_PATH', dirname(ROOT));

That's it.
The security aspects of all this was not thought through, so can
someone let me know what security implications such a config has? Or
even if there is a better way to do this. Thanks again.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to