0

您好我想知道是否有办法在使用 event.buildLink 时在冷箱/CF9 中加载任何页面时重新生成 URL?

目前我在使用 event.buildlink 时得到http://cawksd05.codandev.local:8080/entries/editor 。

但是正确的 url 应该有 /index.cfm 添加到它,如下所示:

/index.cfm/条目/编辑器

有没有办法设置一次以及在哪里设置它,因为我很困惑在哪里为我的所有页面设置它,以便在我执行 event.Buildlink 时添加 /index.cfm 的 url 前缀。

谢谢法希姆

// 一般属性 setUniqueURLS(false); 设置自动重载(假);

// 基本 URL if( len(getSetting('AppMapping') ) lte 1){ setBaseURL(" http://#cgi.HTTP_HOST#/index.cfm "); } else{ setBaseURL(" http://#cgi.HTTP_HOST#/#getSetting ('AppMapping')#/index.cfm"); }

// 你的应用程序路由 formatConstraints = {format="(xml|json)"};

addRoute(pattern="/api/:format/tasks/completed",handler="tasksAPI",action="list",constraints=formatConstraints,completed=true); addRoute(pattern="/api/:format/tasks",handler="tasksAPI",action="list",constraints=formatConstraints); addRoute(pattern="/api/:format?",handler="tasksAPI",action="invalid");

addRoute(pattern="/tasks/list/:status?",handler="tasks",action="index"); addRoute(pattern=":handler/:action?");

4

2 回答 2

4

不,setnextevent 是 3.0 中唯一应该使用的方法,其他的 setnextRoute 和 relocate() 现在已弃用。

如果您对 Route.cfm 进行了更改,请确保重新初始化应用程序以使更改生效。

index.cfm?fwreinit=1

如果进行更改,他们通常会忘记重新启动应用程序。

于 2010-06-05T15:46:54.367 回答
1

听起来您需要在 /config/Routes.cfm 文件中设置 baseURL

// Base URL
if( len(getSetting('AppMapping') ) lte 1){
    setBaseURL("http://#cgi.HTTP_HOST#/index.cfm");
}
else{
    setBaseURL("http://#cgi.HTTP_HOST#/#getSetting('AppMapping')#/index.cfm");
}

对比

// Base URL
if( len(getSetting('AppMapping') ) lte 1){
    setBaseURL("http://#cgi.HTTP_HOST#/");
}
else{
    setBaseURL("http://#cgi.HTTP_HOST#/#getSetting('AppMapping')#/");
}
于 2010-06-04T19:57:26.607 回答