<cfset self = "/index.cfm" />
<cfset selfAction = self & "/" & application.fusebox.fuseactionVariable & "/" />
The /ses.cfm just contains this code:
<cfset selfAction = self & "/" & application.fusebox.fuseactionVariable & "/" />
<cfset isArg = true />
<cfloop list="#CGI.PATH_INFO#" index="av" delimiters="/=&">
<cfif isArg>
<cfset argName = av />
<cfelse>
<cfset URL[argName] = av />
</cfif>
<cfset isArg = not isArg />
</cfloop>
Using /=& for delimiters just means that any leftover &arg=value pairs in the URL will be correctly handled.
Then I went through my display fuses fixing most (all?) of the old &arg=value URLs.
A minor gotcha: relative file paths don't always work (hence /index.cfm) so I had to fix a few image references etc.
Let me know if you find any broken links as a result of this change.<cfloop list="#CGI.PATH_INFO#" index="av" delimiters="/=&">
<cfif isArg>
<cfset argName = av />
<cfelse>
<cfset URL[argName] = av />
</cfif>
<cfset isArg = not isArg />
</cfloop>

30 responses so far ↓
1 Geoff Bowers // Sep 22, 2005 at 5:09 PM
2 Raymond Camden // Sep 22, 2005 at 7:19 PM
3 Yacoubean // Sep 23, 2005 at 7:36 AM
4 Raymond Camden // Sep 23, 2005 at 7:41 AM
5 Yacoubean // Sep 23, 2005 at 7:47 AM
Ok, so you didn't write a .cfm to clean up the MG output, you wrote a webserver extension (or what ever you'd call it). That's very smart, and I'm impressed. But, I still don't like that people have to hack their frameworks to get them to put out clean code. Isn't the idea behind frameworks to make it easy for you to write good, clean, OO code? Then why do the frameworks create 'dirty' code?
6 Raymond Camden // Sep 23, 2005 at 8:01 AM
7 Yacoubean // Sep 23, 2005 at 8:10 AM
8 Raymond Camden // Sep 23, 2005 at 8:14 AM
9 Yacoubean // Sep 23, 2005 at 8:18 AM
10 Raymond Camden // Sep 23, 2005 at 8:20 AM
11 Yacoubean // Sep 23, 2005 at 8:24 AM
12 Sean Corfield // Sep 23, 2005 at 10:24 AM
Now, as it happens, Model-Glue 1.0 (coming soon) has an extension point that allows SES to be coded "into" the framework. I recently posted to the Model-Glue mailing list how to do that. Again, no change to the framework at all - a great bit of design on Joe Rinehart's part to be able to offer such a seamless extension point!
13 Yacoubean // Sep 23, 2005 at 10:35 AM
But, I have been soundly spanked by you and Ray, and I'm happy to go back to my corner. ;)
Actually, I have almost been convinced to learn a framwork and apply it to my future applications. The reason? Frameworks appear to provide a standard for good coding practices. I said 'appear' because there are countless frameworks out there, and everybody seems to have their own hacked version of the framework (I am not point at you, nor Ray).
If the frameworks would keep a stable core that almost never changes, and all of the coders would refrain from hacking the core (which is something I've heard you stress, Sean), then they would be great.
I'd be even happier if Helms, Dealy, Rinehart, and all of the others out there would get together and make a true standard CF framework. Now that would be something to party about!
14 Sean Corfield // Sep 23, 2005 at 11:56 AM
Now, as it happens, Fusebox compiles that XML to CFML code that is typical of compiler-generated code. The parsed/ directory should be considered "magic" and never examined since it contains machine-generated code that would never pass anyone's test of best practices. That has nothing do with *using* the framework, however.
Anyone who is using a "hacked version" of a framework is not using a framework, IMO.
There cannot be a single "true standard" framework because there are different applications out there that have different needs. Hence, different frameworks suit different applications.
If you ever come to one of my frameworks talks, you'll hear me talk about different situations where you might choose Fusebox, Model-Glue or Mach II depending on your needs. You'll also hear me talk about the pros and cons of each framework.
15 Yacoubean // Sep 23, 2005 at 12:37 PM
"The parsed/ directory should be considered 'magic' and never examined since it contains machine-generated code that would never pass anyone's test of best practices."
That comment kind of bothers me, but I know why you made it. It is a desire to keep and maintain a standard. If I go look at the generated code, I might be tempted to hack the framework, which would break the standard (which is bad).
16 Sean Corfield // Sep 23, 2005 at 12:56 PM
A lot of people have misconceptions about Fusebox - and frameworks in general. I was a vociferous opponent of Fusebox back in the day but now I'm a strong advocate, as I am for Model-Glue and Mach II.
17 Yacoubean // Sep 23, 2005 at 1:02 PM
I also have to admit that a big reason I don't want to learn a framework is just that. I don't want to learn a framework. I'm lazy. :)
18 Sean Corfield // Sep 25, 2005 at 11:56 PM
I rarely find the constraints bothersome - but I've programmed with some very rigid frameworks in the past. Fusebox et al are very lightweight by comparison...
19 Sean Kozey // Sep 26, 2005 at 12:34 PM
Have you tested ISAPIRewrite on a site under relatively heavy load? I'm curious as to what the overhead of having the filter run on every request would be.
For the sake of (very) loosely defining what I mean by "heavy", say over 100,000 page requests a day, where most of the page requests are being processed through the application server and involve executing some server-side scripting.
20 Raymond Camden // Sep 26, 2005 at 12:49 PM
21 Sean Corfield // Sep 26, 2005 at 5:53 PM
22 Nando // Sep 26, 2005 at 7:34 PM
Although Spike's friendly url system seemed perfect at first, that's the one FarCry uses i think, what i wound up with is a system that writes static .cfml files to the root of the site with the dynamic url specified within it like the following:
getPageContext().include("index.cfm?view=24.12&lan=en");
The faux static .cfml page is named according to the page settings a user specifies, and the site navigation adjusts itself accordingly.
Not trivial, to be sure, but it's self-contained - it'll function even when we don't have access to settings on the server. And most importantly, we can specify a url that can go into a print advert. And that *may* help search engine placement by handing a keyword to the bot in the url.
23 Sean Corfield // Sep 26, 2005 at 9:40 PM
24 Mike // Nov 24, 2005 at 9:57 AM
It's a small price to pay IMO when you get the benefits of a framework. I have a largish site using FB4, and it's doing very well in the search engines with SES. One benefit that SES has over a physical file, is you can inject keywords into linking URLs for SEO.
eg:
"corfield.org/index.cfm/ColdFusion/Guru/go/do.something/"
:)
25 Clint // Jan 20, 2006 at 3:18 PM
26 Sean Corfield // Jan 20, 2006 at 4:01 PM
27 Clint // Jan 24, 2006 at 12:17 PM
28 se // Sep 1, 2006 at 6:51 PM
29 Dave Cahill // May 15, 2008 at 9:37 PM
30 Chris Bowyer // May 25, 2008 at 4:20 AM
<parameter name="queryStringStart" value="/" />
<parameter name="queryStringSeparator" value="/" />
<parameter name="queryStringEqual" value="/" />
Leave a Comment