Living on the blogcfc bleeding edge
UPDATE: This code won't work, as it won't replace special characters. There is a method called MakeTitle in the blogCFC to do this - thanks Ray.
UPDATE `tblblogentries`
SET alias = REPLACE(title,' ', '-')
Update: Changed from SQL to CF to do the update utilising one of Rays methods already in place. Because of this you have to run this from withing the BlogCFC folder - or make the necessary changesSET alias = REPLACE(title,' ', '-')
<cftry>
\n<!--- Get the titles --->
\n<cfquery datasource="#application.blog.getProperty('dsn')#" name="t">
\n SELECT id, title FROM tblblogentries t
\n</cfquery>
\n<!--- Update the alias's --->
\n<cfloop query="t">
\n <cfquery datasource="#application.blog.getProperty('dsn')#">
\n UPDATE `tblblogentries`
\n SET alias = <cfqueryparam cfsqltype="cf_sql_varchar" value="#application.blog.MakeTitle(trim(t.title))#" />
\n WHERE id = <cfqueryparam cfsqltype="cf_sql_varchar" value="#t.id#" />
\n </cfquery>
\n</cfloop>
\n<cfcatch><cfdump var="#cfcatch#"><cfabort></cfcatch>
\n</cftry>
This will also replace all your old alias's. Soif you don't want the script to do that you will need to add a WHERE to that SQL call.Thats it really. I had a little bit of trouble with the skin mainly because my index.cfm is a little different to that in the BlogCFC code so i always need to do a compare and check everything new is added, but apart from that it went well.\n<!--- Get the titles --->
\n<cfquery datasource="#application.blog.getProperty('dsn')#" name="t">
\n SELECT id, title FROM tblblogentries t
\n</cfquery>
\n<!--- Update the alias's --->
\n<cfloop query="t">
\n <cfquery datasource="#application.blog.getProperty('dsn')#">
\n UPDATE `tblblogentries`
\n SET alias = <cfqueryparam cfsqltype="cf_sql_varchar" value="#application.blog.MakeTitle(trim(t.title))#" />
\n WHERE id = <cfqueryparam cfsqltype="cf_sql_varchar" value="#t.id#" />
\n </cfquery>
\n</cfloop>
\n<cfcatch><cfdump var="#cfcatch#"><cfabort></cfcatch>
\n</cftry>