On 2/13/08, Les Mizzell <[EMAIL PROTECTED]> wrote:
>
> I started with this:
> http://www.mysite.com/seminar.cfm?id=Foreign08
>
>
> Upon client request, I rewrote it to this:
> http://www.mysite.com/seminar.cfm/Foreign08
>
>
> Now they want this:
> http://www.mysite.com/seminar/Foreign08
>
>
> I've not been able to figure a way to do it without the .cfm extension.
>
>
> Ideas?



You could store the CGI.SCRIPT_NAME in the database, use cffile to create
the directory structure with a index.cfm file in the final folder, then look
for that content when a page is loaded.
First to some replace
/seminar/Foreign08

i do this a bunch because I don't have access to webserver URL rewrite tools
a lot of the time, and it goes a little something like this.

1) Person makes a post, take the tile and clean up the text with some regex,
also making it lowercase.

     <cfset FileName = LCase(Cleaned.Title)>

2) Find the folder this is going in from the main category

<cfset Folder = #q.FolderName#>

3) Create the folders and file

<cfset StartPath = "#ExpandPath( "/")#">

<cfset SavePath = "#StartPath#\#Folder#\#PageTitle#">

<cfif DirectoryExists(SavePath)>

 Sorry, or just skip this step, or rename the file or something then
continue

<cfelse>

    <cfdirectory action = "create" directory = "#SavePath#">

      <CFSET sFileOutput = "">
    <CFFILE Action="Write" File="#SavePath#\index.cfm"
Output="#sFileOutput#">

</cfif>

<cfset FORM.SCRIPT_NAME = "/#Folder#/#PageTitle#/index.cfm">

Update/insert into table

Then when you want the data on the frontend

     SELECT the fields from Pages
        WHERE SCRIPT_NAME = #CGI.SCRIPT_NAME#

This is really trimmed down but works well I guess. I haven't had any real
troubles with it. Sometimes they may change the tile which I normally handle
with setting the index.cfm page in the old folder with a 301 redirect line
to the new location instead of deleting the folder completely and receiving
404 errors.

Casey


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:298899
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to