situation, I do it like this (hope I don't forget anything)
1. Create a folder called /sites
2. Put directories in that folder that match the host name of the the
site (ie. mysite.localhost OR mysite.com OR subdomain.mysite.com)
3. By default I copy the /app/config, /app/locale/, /app/tmp folders
from /app into those new directories.
4. Then inside of /app/webroot I create another directory named after
the site host name (ie. /app/webroot/mydomain.com)
Intermission NOTE : I create /sites/mydomain.com in order to hold
custom controllers, models and views and overwrite my main /app
controllers models views in case I need something custom for one of
those sites. (So I'm using the same /app unless its absolutely
necessary to make a one off mvc custom for a site) ---- I create /app/
webroot/mydomain.com so that I can easily have custom js, css, and img
for each site. Back to step by step (here's where the magic
happens)...
5. Open /app/webroot/index.php and change the definition of APP_DIR
to this...
if (!defined('APP_DIR')) {
/* enable this if you want to support multiple domains or sites */
define('APP_DIR', 'sites'.DS.$_SERVER['HTTP_HOST']);
/* disable this if you want to support multiple domains or sites */
#define('APP_DIR', basename(dirname(dirname(__FILE__))));
}
define('IMAGES_URL', '');
define('CSS_URL', '');
define('JS_URL', '');
6. Open bootstrap.php in each site you have a /sites/mydomain.com/
config/bootstrap.php file and add this... (this is where you tell it
to look for your custom mvc files first and if they don't exist then
use the main mvc files that all of your sites use)
App::build(array(
'plugins' => array(
$_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'plugins'.DS,
$_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'plugins'.DS
),
'models' => array(
$_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'models'.DS,
$_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'models'.DS
),
'views' => array(
$_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'views'.DS,
$_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'views'.DS
),
'controllers' => array(
$_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'controllers'.DS,
$_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'controllers'.DS
),
'datasources' => array(
$_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'models'.DS.'datasources'.DS,
$_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'models'.DS.'datasources'.DS
),
'behaviors' => array(
$_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'models'.DS.'behaviors'.DS,
$_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'models'.DS.'behaviors'.DS
),
'components' => array(
$_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'controllers'.DS.'components'.DS,
$_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'controllers'.DS.'components'.DS
),
'helpers' => array(
$_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'views'.DS.'helpers'.DS,
$_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'views'.DS.'helpers'.DS
),
# You could probably do these too, I just haven't had a need for them
yet.
# 'vendors' => array('/full/path/to/vendors/', '/next/full/path/to/
vendors/'),
# 'shells' => array('/full/path/to/shells/', '/next/full/path/to/
shells/'),
# 'locales' => array('/full/path/to/locale/', '/next/full/path/to/
locale/')
));
7. Go to https://cakeforge.org/projects/zuha/ and become a member so
that you can download a functional version of this and tons more pre-
alpha code (like a CRM, Project Manager, CMS, MU Blogs, Wikis and more
to come) --- Okay so I stuck some shameless promotion for my app in
here -- shoot me.
Richard @ RazorIT.com
On Sep 1, 7:03 am, drpark <webmas...@attractionland.com> wrote:
> Hello,
> we are doing this for one of our customer.
>
> We have 4 cake directory structures pointing with virtual directories
> for /models, /controllers, and /views
> In each of these we have a different database (same structure but
> different datas) and different files in webroot, locale, and tmp
> Like if it was 4 separate applications, but using the same
> models,controllers, views
>
> Hope this was helpful, my english is poor
>
> regards
>
> On 31 août, 04:34, Kazi Harun Or Roshid <kharun...@gmail.com> wrote:
>
>
>
> > Hello Expert,
>
> > I am new on cakephp. I want to develop our website to cakephp. I want to
> > use same application for multiple website different layout and css. and I
> > want to use our existing table structure so its not follow the rules on
> > cakphp table name Conventions. I dont know this way it will be work or not?
> > and how I make folder structure?
>
> > Advance thanks
> > Harun
>
> > --
> > Kazi Harun Or Roshid
> > Mob# +357-96351387
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 cake-php@googlegroups.com
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?hl=en
No comments:
Post a Comment