当前位置: 动力学知识库 > 问答 > 编程问答 >

configure multiple application use common controller model view in cakephp

问题描述:

suggest me to best idea to develop multiple application for common controller,model,view in cakephp.

anybody have idea for develop this type application please suggest me.

网友答案:

This is what Plugins are for - you can create a set of controllers, models, views (and a lot more), package them together and then deploy them to all of you applications. See the CakePHP cookbook for specifics.

Using this approach would add an extra plugin portion to your urls, which can be fixed by providing routing rules.

网友答案:

There are two ways of doing this.

  1. Package your common controllers, models & views as a plugin
  2. Put your common code in a seperate set of directories and use App::build() in bootstrap.php to include those directories:

    App::build(array( 'plugins' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'), 'models' => array('/full/path/to/models/', '/next/full/path/to/models/'), 'views' => array('/full/path/to/views/', '/next/full/path/to/views/'), 'controllers' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'), 'datasources' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'), 'behaviors' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'), 'components' => array('/full/path/to/components/', '/next/full/path/to/components/'), 'helpers' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'), '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/') ));

分享给朋友:
您可能感兴趣的文章:
随机阅读: