2014-03-18 39 views
0

我需要雇用webEdition作为网络存在的CMS,它应包含用CakePHP实现的表单。不幸的是,这两个系统都采用了目录结构,这些目录结构彼此不兼容:CakePHP需要一个带有几个子文件夹,“Model”,“View”,“Controller”的“app”文件夹,而webEdition提供了(php)模板文件,前端(html)文件是通过一个必须保持功能的http后端生成的(因为它是首先使用webEdition的要点)。因此,尽管我可以将模型和控制器文件放入它们各自的CakePHP文件夹中,但我需要将视图代码写入webEdition模板中。 CakePHP offers configuration files将其整个“应用程序” - 文件夹移动到任意位置,但这可能不是我需要的。cakephp与外部查看文件

总之,情况如下所示:

  • webEdition需要的模板去[根目录]/webedition /我们/模板/ [文件] .PHP
  • CakePHP的需要查看文件[扩展]
  • 查看代码必须进入模板
  • 对View代码的引用必须引用已发布的文件[webroot]/[应用程序/视图/ [控制器名称]/[文件] [file] .html

显然这些要求是不相容的。 Mayhap我的理解是错误的,但即使不是,应该(希望)存在一种替代方法来实现这一点。

回答

0

的要求显然是不兼容的,但有几个方法可以解决的是:

  • 使用AJAX或iframe来调用CakePHP的应用程序直接
  • 让webEdition处理形式完全让CakePHP的形式在它自己的,但写入蛋糕应用程序正在使用的数据库表
  • 有一个RESTful API,你不能从webEdition页面调用并将数据发布到CakePHP应用程序。
+0

呃。我想,很不理想但可行。 谢谢。 – Zsar

+0

我认为你可以采用RESTful方式,在Cake中设置很容易,并且可以通过JS完成整个HTTP POST。所以在CMS中,你只需要一个表单模板和一些JS。我不认为这很难做到。也许〜1小时的工作? – burzum

0

看来,通过/配置/ bootstrap.php中的文件,Web根目录文件夹可能被指定为浏览文件夹此设置的应用程序 - 这无疑是更多的是黑客攻击,但应该允许直接写CakePHP的视图代码转换为webEdition模板,从该模板传送到发布的文件。

/** 
* The settings below can be used to set additional paths to models, views and controllers. 
* 
* App::build(array(
*  'Model'      => array('/path/to/models/', '/next/path/to/models/'), 
*  'Model/Behavior'   => array('/path/to/behaviors/', '/next/path/to/behaviors/'), 
*  'Model/Datasource'   => array('/path/to/datasources/', '/next/path/to/datasources/'), 
*  'Model/Datasource/Database' => array('/path/to/databases/', '/next/path/to/database/'), 
*  'Model/Datasource/Session' => array('/path/to/sessions/', '/next/path/to/sessions/'), 
*  'Controller'    => array('/path/to/controllers/', '/next/path/to/controllers/'), 
*  'Controller/Component'  => array('/path/to/components/', '/next/path/to/components/'), 
*  'Controller/Component/Auth' => array('/path/to/auths/', '/next/path/to/auths/'), 
*  'Controller/Component/Acl' => array('/path/to/acls/', '/next/path/to/acls/'), 
*  'View'      => array('/path/to/views/', '/next/path/to/views/'), 
*  'View/Helper'    => array('/path/to/helpers/', '/next/path/to/helpers/'), 
*  'Console'     => array('/path/to/consoles/', '/next/path/to/consoles/'), 
*  'Console/Command'   => array('/path/to/commands/', '/next/path/to/commands/'), 
*  'Console/Command/Task'  => array('/path/to/tasks/', '/next/path/to/tasks/'), 
*  'Lib'      => array('/path/to/libs/', '/next/path/to/libs/'), 
*  'Locale'     => array('/path/to/locales/', '/next/path/to/locales/'), 
*  'Vendor'     => array('/path/to/vendors/', '/next/path/to/vendors/'), 
*  'Plugin'     => array('/path/to/plugins/', '/next/path/to/plugins/'), 
*)); 
* 
*/ 

...虽然尚未测试,但显然不适合生产系统。