Monday, February 27, 2012

Re: CakePHP 2 Folder Structure

So I would recommend having one location of Cake on your root, then
people can just create new applications(or projects) inside this
directory.
So you can access them from example.com/projectname you just simply
move your webroot out of your app(project) folder and rename it to
ProjectName.
Then in your new ProjectName folder(webroot) you can modify the
index.php, to something like what is listed below. This is how I
generally do it so that I can just modify what APP_DIR
and then toss all my applications inside a cake folder that is
chilling on my root. That way only webroot is exposed.
The folder structure of my cake folder is
cake
-lib
-plugins
-vendors
-ProjectName
-ProjectName2
-SomeOtherProj

Then my webroot I can move somewhere and then you just need to add the
appropriate amount of dirnames to get back to your root, and then
specify the folder that you are using, and in my case it is cake.
if (!defined('ROOT')) {
define('ROOT', dirname(dirname(__FILE__)) . DS . 'cake');
}
/**
* The actual directory name for the "app".
*
*/
if (!defined('APP_DIR')) {
define('APP_DIR', 'ProjectName');
}

On Feb 27, 11:06 am, Jordy van Kuijk <jvank...@gmail.com> wrote:
> Hi, thanks for responding.
>
> We're working with a team on this project. Everyone has his/her own
> working copy of the folder structure I gave above.
> Ideally, the situation would be in which every user would have his/her
> copy of the "projectname" folder only, and let the contents of
> ProjectName (without "projectname") rest somewhere on our project
> server.
>
> Is it possible to define the DS, ROOT, APP_DIR to be a somewhere on
> server (for example:http://server.com/ProjectName/)?
>
> I hope you understand what I mean.
>
> On Feb 27, 7:16 pm, thatsgreat2345 <thatsgreat2...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I'm not sure what you're asking, but it sounds like you want to move
> > it somewhere else. You can do this by moving your webroot, and then
> > modifying your webroot index.php file and pointing it to where cake is
> > at (lib) and then also providing it the name of your application
> > folder (projectname)
>
> > On Feb 27, 9:30 am, Jordy van Kuijk <jvank...@gmail.com> wrote:
>
> > > Hi all,
>
> > > I'm working on transferring an existing PHP application to the CakePHP
> > > framework.
> > > I've baked all my models, controllers and views.
>
> > > My folder structure looks like this:
>
> > > ProjectName
> > >    - app
> > >    - lib
> > >    - projectname
> > >       - Config
> > >       - Console
> > >       - Controller
> > >       - Lib
> > >       - Locale
> > >       - Model
> > >       - Plugin
> > >       - Test
> > >       - tmp
> > >       - Vendor
> > >       - View
> > >       - webroot
> > >    - plugins
> > >    - vendors
> > >    - index.php
>
> > > When I point my local server to the "projectname" folder, all works
> > > fine.
> > > I would like to let "projectname" work independently.
> > > The "Lib" folder, for example, is empty, and the actual lib files are
> > > stored in "lib".
>
> > > Is there a way to fix this?
>
> > > Thanks in advance.
>
> > > Jordy

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