2014-03-18 35 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/'), 
*)); 
* 
*/ 

...雖然尚未測試,但顯然不適合生產系統。