我想第一次使用映射,我有一些問題。在我CFadmin我創建了一個映射這是這樣的:Coldfusion映射cfinclude
邏輯路徑:
/email_sender
目錄路徑:
E:\sites\Example.Com\cf_modules\autoresponders\Emails\emailLists
我試圖從.cfc訪問包含文件。在我的cfc裏面,我有一個包含在同一個文件夾中的文件,它工作的很好,但是包含文件正在根據我傳遞的信息綁定到另一個包含文件。
組件中的包含文件在其中包含此代碼。
<cfmail from="#emailData.sender#" to="#surveymain.email#" subject="#subject#" type="HTML" >
<cfinclude template="#emailData.includePath#" >
</cfmail>
只是爲了更清楚,這是我的總的文件系統:
access.cfm -> some.cfc -> include_1 (works) -> include_2 (issue with the path)
我有一個try/catch哪些電子郵件我的錯誤,它位於include_1內。
如何使用我創建的映射最終能夠訪問我的包含文件?
請注意,emailLists
之後,我有動態文件夾,根據我試圖發送電子郵件的客戶端而有所不同。因此該路徑的最終結果將是:
E:\sites\Example.Com\cf_modules\autoresponders\Emails\emailLists\client_A\email_template.cfm
我試圖用我的映射做這個 <cfinclude template="/email_sender/#emailData.includePath#" >
這給了我這個錯誤:
The path to the CFC must be specified as a full path, or as a relative path from the current template, without the use of mappings.
而且,我試着包括cfinclude中的完整路徑也導致了以下錯誤:
Note: If you wish to use an absolute template path (for example, >template="/mypath/index.cfm") with CFINCLUDE, you must create a mapping for the path using the ColdFusion Administrator. Or, you can use per-application settings to specify mappings specific to this application by specifying a mappings struct to THIS.mappings in Application.cfc.
Using relative paths (for example, template="index.cfm" or template="../index.cfm") does not require the creation of any special mappings. It is therefore recommended that you use relative paths with CFINCLUDE whenever possible.
任何幫助/建議將不勝感激
編輯: 重新啓動該工作的版本是這樣的一個服務器後: <cfinclude template="/email_sender/#emailData.includePath#" >
感謝那些誰回答。
自從您添加映射後,您是否重新啓動了服務器? – John
當然它必須是這....感謝提醒我,現在它工作正常.. – Geo