冷融合映射错误

发布于 2024-12-05 23:37:42 字数 203 浏览 3 评论 0原文

注意:如果您希望使用绝对模板路径(例如, template="/mypath/index.cfm") 与 CFINCLUDE,您必须创建一个 使用 ColdFusion Administrator 映射路径。

我进入了管理页面,但不知道要在这里输入什么。 我对冷融合还很陌生。任何人都知道为什么会发生这种情况。

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.

I went to the administration page but not sure what to put in here.
I'm pretty new to coldfusion. anyone got any ideas why this would be happening.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小情绪 2024-12-12 23:37:42

CFINCLUDE 使用与 cfinclude 所在文件相关的相对路径,因此如果想要在另一个目录中包含文件,1. 它必须位于站点的 wwwroot(或根目录或子目录)内,2. 您可以通过执行以下操作转到其他目录...希望这会有所帮助。如果您想要包含 wwwroot 之外的文件,则在包含该文件时,您需要使用与上述相同的语法在 Coldfusion Administrator 中映射该目录。

CFINCLUDE uses relative paths in relation to the file where the cfinclude is, so if want to include a file in another directory, 1. it has to be inside your wwwroot (or the root directory, or subdirectories) of your site, 2. you can go to other directories by doing ... hope this helps a little bit. If you want to include a file that is outside of your wwwroot, then you'll need to map that directory in Coldfusion Administrator using the same syntax above when you do include it.

仅冇旳回忆 2024-12-12 23:37:42

要添加映射,请打开 Coldfusion 管理员。

服务器设置>映射

有 2 条路径。逻辑和目录。

逻辑可以是您想要的任何内容,目录是它映射到的位置。
例如。您的 Web 根目录下可能有一个文件夹,其中存储了映射为的电子邮件模板:

logical path: /emails
directory path: /var/www/mycfapp/content/includes/emails

您可以从任何 cf 模板中 并获取映射。

您也可以使用映射来创建新对象。让我们假装忘记密码是一个 cfc。

fp = new emails.forgotPass();

// if you have funky characters in there, eg dash, just quote it.
fp = new "emails.forgot-pass"();

扩展 cfc 时映射也起作用。除了一个小例外。没有前导斜杠。

component extends="emails/forgotPass" {
    // ...
}

我非常确定首先会检测到映射,因此如果您有一个同名的文件夹,它可能不会被选中。

在 cf9 中,您还可以在 Application.cfc 中指定映射,而不是在 Coldfusion 管理员中指定,这会影响服务器上的所有应用程序。例如。

this.mappings["/emails"] = "/var/www/mycfapp/content/includes/emails";

您需要在 cfadmin 设置页面上勾选启用每个应用程序设置选项。

http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec0b63c-7fd5.html

To add a mapping, open your coldfusion administrator.

Server Settings > Mappings

There are 2 paths. Logical and Directory.

Logical can be anything you want, and directory is where it maps to.
eg. you might have a folder below your web root which stores email templates mapped as:

logical path: /emails
directory path: /var/www/mycfapp/content/includes/emails

You can <cfinclude template="/emails/forgotPass"> from any cf template and the mapping would get picked up.

You can use the mappings for new object creation too. Lets pretend forgotPass is a cfc.

fp = new emails.forgotPass();

// if you have funky characters in there, eg dash, just quote it.
fp = new "emails.forgot-pass"();

Mappings also work when extending cfcs. With one small exception. No leading slash.

component extends="emails/forgotPass" {
    // ...
}

Im pretty sure mappings are detected first, so if you have a folder with the same name it might not get picked up.

In cf9 you can also specify your mappings in your Application.cfc, instead of coldfusion administrator, which affects all applications on your server. eg.

this.mappings["/emails"] = "/var/www/mycfapp/content/includes/emails";

You'll need to tick the Enable Per App Settings option on the cfadmin Settings page.

http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec0b63c-7fd5.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文