Wouldn't doing a fileExists() on every request be pricey? --- Billy Cravens
-----Original Message----- From: Julian Halliwell [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 7:49 AM To: [EMAIL PROTECTED] Subject: Re: FaFiles: handling defaults Patrick, yes I've got the try/catch and it works on CF4.5 but I'd prefer to channel to a default rather than throw an error if someone types a bad fuseaction. I guess the fileExists function would do the job. Putting this above the include in the switch file seems to work: <cfscript> fa_file = fusebox.currentpath & "fa_" & fusebox.fuseaction & ".cfm"; fa_file_path = expandPath(fa_file); if(not fileExists(fa_file_path)) { fusebox.fuseaction = "home";} </cfscript> <cfinclude template="fa_#fusebox.fuseaction#.cfm"> Julian. ----- Original Message ----- From: "Patrick McElhaney" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, March 25, 2002 12:58 PM Subject: RE: FaFiles: handling defaults > Julian, > > If you look at the code on the wiki page, I have a <cfthrow> > tag that reports an invalid fuseaction. You can replace that > line with whatever code you want. > > What version of CF are you using? I've only tested the code > on CF5, but I'm sure it could be modified so that it works > on 4.xx, if it doesn't already > > Patrick > > > -----Original Message----- > > From: Julian Halliwell [mailto:[EMAIL PROTECTED]] > > Sent: Monday, March 25, 2002 7:37 AM > > To: [EMAIL PROTECTED] > > Subject: FaFiles: handling defaults > > What's the best way of implementing defaults though if I > > don't want missing > > include errors to be thrown where the fuseaction passed > > doesn't match an fa_ > > file? ==^================================================================ This email was sent to: [email protected] EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrFMa.bV0Kx9 Or send an email to: [EMAIL PROTECTED] T O P I C A -- Register now to manage your mail! http://www.topica.com/partner/tag02/register ==^================================================================
