On 3/12/08, Rick Faircloth <[EMAIL PROTECTED]> wrote: > > Casey... > > Do the "replace's" that you use below take care of *all* > unwanted filename characters? I'm thinking about implementing a > page-creation tool, also, > and didn't think about the problems that could be created > with bad filenames a user might create.
I haven't had any troubles with it but then again, I normally do most of the initial setup for my clients. I doubt 4 out of 5 even create a new page. I would go with something like Denny has for cleaning up the name, then adding .cfm to the end. Denny, I can see where you are headed there. The only issue I have with that, if the end user wants to change the name of the file after it's been put into play, or delete the file all together, you would end up with a bunch of dead links. In this type of scenario, I'd end up rewriting the page content with a 301 redirect to the new page or a message stating that that page does not exist. You also have some issues with re-writing all of the pages when someone wants to change the location of the banner or another template type modification, I guess you could have a script go through and re-write all pages... Most likely if I were to go that route I would still consider writing the page as .cfm just in case. Bruce... > > I tinkered with page creation, too, and used a template > for the basis of a new page, then used <cffile action = "append"... > to add the HTML to the template. I also updated a menu.cfm file using > append to add the new page name to the menu and cfincluded the menu.cfm > in the new page. > > So basically, I just used cffile to copy the existing template > to the requested filename, then used cffile append to the HTML > and also used cffile append to update any cfincluded files, > like the menu.cfm I mentioned. > > I'm also planning to use the CF8 FCKEditor (modified to be able to > add photos, etc.) to allow the user to create the main content for the > page. > > Pretty straightforward. > > Rick > > > > > -----Original Message----- > > From: Casey Dougall [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, March 12, 2008 8:16 PM > > To: CF-Talk > > Subject: Re: Creating a .cfm file on the fly > > > > On 3/12/08, Bruce Sorge <[EMAIL PROTECTED]> wrote: > > > > > > I have a client who wants me to make a change to a form he has. > > > Currently he has a page that creates a new project that uses a WYSIWYG > > > editor and put everything into a database table. What he wants instead > > > is for the user to add a page name field in addition to the fields he > > > already has, and when the user submits the form, he wants a .cfm page > > > created with the value from the page name field being the file name. > Of > > > course I need to put the site's header and footer on there as well. So > > > is there a way that I can create a template, and then when the form is > > > submitted, using CFFILE or something like that to take that template > and > > > make a new page with it? Does this even make sense? > > > > > > Thanks, > > > > > > Bruce > > > > > > > > Yeah, I do something like this, you may know some regex that could > eliminate > > half of this junk at the beginning. > > > > <cfset FixedPageName =replace(FORM.PageName," ","-","all")> > > <cfset FixedPageName =replace(FixedPageName,":","","all")> > > <cfset FixedPageName =replace(FixedPageName,"?","","all")> > > <cfset FixedPageName =replace(FixedPageName,"$","S","all")> > > <cfset FixedPageName =replace(FixedPageName,"&","-and-","all")> > > <cfset FixedPageName =replace(FixedPageName,"'","","all")> > > <cfset FixedPageName =replace(FixedPageName,".","","all")> > > <cfset FixedPageName = LCase(FixedPageName)> > > <cfset > > FORM.FixedPageName=replace > (FixedPageName,"#FixedPageName#","#FixedPageName#.cfm","all")> > > > > <CFPARAM name="SavePath" default="#ExpandPath("../../Folder")#"> > > > > <CFSET sFileOutput = ""> > > <CFFILE Action="Write" File="#SavePath#\#FORM.FixedPageName#" > > Output="#sFileOutput#"> > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301128 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

