Hi All,

Last week I had an issue with a client where the FU cfc just stopped working on a site. This is by no way an issue with the CFC, rather... well let us not get into it.

Anyhow, we came up with an alt approach I found a nifty UDF on House Of Fusion by Michael Dinowitz and put together another quick UDF to convert URLs. When all was said and done it worked. It is not as pretty as Spike's URLs, but it did do the trick on this finicky server.


UDF by Michael Dinowitz at House Of Fusion:

<cfscript>
// Convert dynamic URLs with ?&= to value pairs.
//UDF by Michael Dinowitz at HoF

   function SES()
   {
     var UrlVars=ReReplaceNoCase(trim(cgi.Path_Info), '.+\.cfm/? *', '');
     var loopcount=ListLen(urlvars, '/');
     var potential="";
     if (cgi.script_name EQ cgi.path_info)
       return 0;
     for(i=1;i LTE loopcount; i=i+1)
     {
       potential=trim(listgetat(UrlVars, i, '/'));
       if (REFindNoCase('^[a-z][a-z0-9_]*:.*', potential))
SetVariable('Url.'&listfirst(potential, ':'), listlast(potential,':'));
     }
     return 1;
   }
</cfscript>

Invoke via :  <cfset SES()>


<cfscript>
//Strip out dynamic chars and convert to / and :
//This could use some more work, but it works for now
//MJS
function sesURL(str) {
        //replace non ses with ses
        str = replace(str,"?","/","ALL");
        str = replace(str,"&","/","ALL");
        str = replace(str,"=",":","ALL");
        //now return formatted URL
        return str;
}
</cfscript>

Example:  #sesURL("/index.cfm?objectid=#application.navid.ourhistory#")#

Makes URLs that look like this

http://site.com/index.cfm?objectid=7EC656F1-3048-7098-AFC59EF5C703E158

into

http://site.com/index.cfm/objectid:7EC656F1-3048-7098-AFC59EF5C703E158


This would proll be better as a function like buildlink that could do fancier stuff like use page names etc for better indexing. For instance a really long URL with lots-o-vars could look like:

http://site.com/index.cfm/objectid:7EC656F1-3048-7098-AFC59EF5C703E158/navid:67C656F1-3048-7098-23e45EF5C703E158/page:about-us

Anyhow, just a quick fix. A side note. I set up a server to use the new CF7 built in SES module. I got very odd results that did not yeild the reading of the SES URL.


---
Michael

---
You are currently subscribed to farcry-dev as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to