私のアプリケーションには、ヘッダーとフッターがあります。私のApplication.cfcでは、アプリケーションに名前を付けてマッピングを設定する関数を設定しました。<cfinclude> with this.mapping
<cfcomponent output="no">
<cfset this.name = "thesitename">
<cfset this.datasource = "thesitedatasource">
<cfset this.rootDir = getDirectoryFromPath(getCurrentTemplatePath()) />
<cfset this.mappings = structNew()>
<cfset this.mappings["/planning"] = "#this.rootDir#planning/" />
<cfset this.mappings["/images"] = "#this.rootDir#images/" />
<cfset this.mappings["/includes"] = "#this.rootDir#includes/" />
<cfset this.mappings["/js"] = "#this.rootDir#js/" />
<cfset this.mappings["/portfolio"] = "#this.rootDir#portfolio/" />
</cfcomponent>
私はこのようなサブディレクトリ内のページを持っている場合:planning/index.cfm
私は、次のパスを使用した画像フォルダには何も見つけることができない<cfinclude>
:ルートディレクトリ内<li class="imagelink"><img src="/images/facebook.png"></li>
ページはありませんが問題があります。
私が正しく理解していれば、問題は、インクルードが呼び出される前にマッピングが行われていないなどです。マップされたパスがインクルードで正しく動作するようにするにはどうすればよいですか?
本質的に、このマッピングを使用してcfincludeを正しく動作させる方法はありません。したがって、どのようなタイプのコーディングが '(./images)'構文を使用していますか? – Ofeargall
cfinclude 'images'ディレクトリにある可能性があるColdFusionファイルをインクルードすることができますが、imgタグのsrc属性を指定すると、Webブラウザにそのファイルを検索する場所が示され、Webブラウザには何の知識もありません(また、 )ColdFusionマッピングの問題を簡単に解決するには、Apacheまたは '仮想ディレクトリイメージが格納されているフォルダを指しているIIS上の 'イメージ'の場合は 'ry' –