0

私のプラグインでは、カスタム リモート関数を定義しました。内容は次のとおりです。

<cfcomponent output="false">
<cffunction name="getPersons" access="remote" output="false">
<cfset var local = {}>

<cfquery name="local.getPersons" >
  SELECT FirstName FROM Persons
</cfquery>
<cfreturn local.getPersons>
</cffunction>
</cfcomponent>

この関数は、displayObjects/cfc ディレクトリに保存されているファイル mytest.cfc で定義されています。

displayObjects ディレクトリに保存されている main.cfm ファイルで、mytest.cfc の関数に対して ajax 呼び出しを行う必要があります。

どうすれば適切なパスを構築できるのか疑問に思っています。

呼び出しの#$.getCurrentURL()#戻り値:

 http://localhost:8888/mymura/default/

ただし、何らかの形で ajax クエリへの次の指定 URL パスを作成して指定する必要があります。

http://localhost:8888/mymura/plugins/MyTest1_2/displayObjects/cfc/mytest.cfc

プラグイン固有の .cfc ファイルを保存するための推奨される方法と、それらにアクセスするための完全なパスを適切に作成する方法を教えてください。

よろしくお願いいたします。

よろしく、
ピーター

編集:私はほとんどそこにいます:

<cfoutput>
  <a href="#$.currentURL() & pluginConfig.getDirectory()#/displayObjects/cfc/myquery.cfc">My other file</a>
</cfoutput>

これは以下を返します:

http://localhost:8888/mymura/default/MyTest1_2/displayObjects/cfc/mytest.cfc

それ以外の:

http://localhost:8888/mymura/plugins/MyTest1_2/displayObjects/cfc/mytest.cfc

メソッドは を$.currentURL()返しますlocalhost:8888/mymura/default。1 つのディレクトリをたどって「プラグイン」を追加する方法を見つける必要があるだけです。

どんな助けでも大歓迎です。

4

1 に答える 1

0

You can construct the URL using the domain setting of the site:

$.siteConfig().getDomain() & "/plugins/" & pluginConfig.getDirectory() & /displayObjects/cfc/myquery.cfc
于 2013-10-22T07:33:22.637 に答える