[ic] Custom flypage URL

Davor Ocelic docelic at spinlocksolutions.com
Tue Nov 27 19:24:33 EST 2007

On Tue, Nov 27, 2007 at 05:32:44PM -0600, Josh Lavin wrote:
> Anyone know of a way to have the product description in the flypage  
> URL, such as:
>    www.foo.com/123/The_123_Book
> instead of only having the code in the URL, as usual:
>    www.foo.com/123
> I was thinking of an ActionMap, but those seem to require a directory  
> in between, like:
>    www.foo.com/foo/123


I suppose you'd want the descriptions to appear up-front,
embedded in the <a> link, not to appear later, after the visitor
clicks the descriptionless foo.com/123, right?

To take care of the URL generation problem,
you could have a function that takes product code as argument,
retrieves its description and returns the URL you want.
Then modify page/area tags or write a custom tag that embeds the
description in the URL.
If that would generate too much additional database traffic,
you can Perl Memoize the function to cache URLs. (perldoc Memoize).

As for the link which would look like foo.com/code/description ,
if you absolutely want "/description" (and not "?description" or
something), that would get misinterpreted by the web server as page
"description" within directory "code". In that case that
file would not exist, so the special page 'missing' would be
invoked by IC. You could modify code for missing.html to 
detect this case and keep this URL while showing the real
flypage you expect.

In fact, this is close to what IC already does when the page
is missing (it checks if the missing filename is valid product
SKU), so you could just slightly modify this routine to not
get confused by '/description' in the URL.


More information about the interchange-users mailing list