Hi Jeff,

The problem here is that the deleteAll() method in fu.cfc uses application.config.fusettings.domains to filter the mappings that will be removed. If you've removed your domain from the list before running deleteAll() any mappings for that domain will not be deleted.

One solution to the problem is to create a custom deletion template with the following code:

<cfset dataClass = createObject("java", "FriendlyURLData")>
<cfset dataObject = dataClass.getInstance()>
<cfset mappings = dataObject.getMappings()>
<cfloop collection="#mappings#" item="alias">
  <cfset bDelete = false>
  <!--- Put any deletion checks here --->

  <cfif bDelete>
    <cfset dataObject.removeMapping(i)>
  </cfif>
</cfloop>

Once you've removed all the mappings, you can re-create the ones you want using the farcry admin area.

You could alternatively use the setMapping() method of the FriendlyURLData class to create the mappings manually.

That method takes 2 parameters.
The first is the alias which is the concatenation of domain, "/go" and the path you want to use. eg. "#cgi.script_name##application.config.fusettings.urlpattern#/products/mywidgets"


The second parameter is the mapping, the relative URL that the mapping points to. eg.
"/index.cfm?objectid=1B032816-9B4B-378F-407C4C5B98C852E7"


If the alias already exists, it is updated to point to the new mapping. If it doesn't already exist, it is created.

Hopefully that is enough info to allow you to write your own custom cfm template to add/edit/delete in any way you want.

The problem with changing the text file is that it's only read the first time the FriendlyURLData class is instantiated. That could be either when you modify a mapping, or when someone makes a request that uses a /go URL.

In order to do anything with the text file, you need to first stop the server, make any changes, then start the server again. That's why I said in a previous post that I don't think there is much use in putting it in the application directory. You can't do anything useful with it anyway, and you can get all the info out of it easily by running the following code:

<cfset dataClass = createObject("java", "FriendlyURLData")>
<cfset dataObject = dataClass.getInstance()>
<cfset mappings = dataObject.getMappings()>

Once you've got all the mappings you can loop over them the same way you would a coldfusion struct and manipulate as I mentioned above.

Spike


Jeff Coughlin wrote:

Spike,

This may be off-topic (not sure). I used the FU with Farcry b220 (now latest p220) a while back on an intranet site for a client. The first time I ran "Reset all Friendly URLs" I had the setting "URLPATTERN" incorrect (set to "go/"). So I fixed it and ran it again later (after adding more content and navigation). I set it to "/go/". Only the new navigation nodes took the new setting. The old navigation nodes took the old setting. I then disabled FU for a while, made more navigation nodes, then decided to play with the settings some more.

Because its an intranet site I was setting the config "DOMAINS" to the NetBIOS name "/Intranet" (lets just assume the NetBIOS name is "Intranet"). By mistake I typed in "//Intranet" during one of the "Reset all Friendly URLs". Okay, now all the links are messed up.

----------
Question 1: How do I tell the system to actually "reset" the URLs to use the new settings (no matter how often I change them)? Or is this just a one shot deal?


Question 2: Because I run many websites per server, is it possible to remove links from FriendlyURLs.txt if the site no longer exists?
----------


(note: I've tried overwriting FriendlyURLs.txt with the original, but when I run "Reset all Friendly URLs" it goes back to the incorrect links. Unfortunately I don't know any Java, so the .txt file was as far as I could go :) )

Regards,

Jeff C.



--

--------------------------------------------
Stephen Milligan
Code poet for hire
http://www.spike.org.uk

Do you cfeclipse? http://cfeclipse.tigris.org

---
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