Cannot find procedure CFSCRIPT

I wrote a short CFscript to encode / decode links:

    function link_encode(str) {
    x = Replace(str, "&", "and", "ALL");
    y = Replace(x, " ", "_", "ALL");
    z = Replace(y, "/", "|", "ALL");
    return z;
}

function link_decode(str) {
    x = Replace(str, "and", "&", "ALL");
    y = Replace(x, "_", " ", "ALL");
    z = Replace(y, "|", "/", "ALL");
    return z;
}

This is the file that is included in the site header (included on each page).

<cfinclude template="/includes/cfScriptFunctions.cfm">

This works fine on a "normal" page:

<cfset link = link_encode(sub_menu.name)>

But for SEO purposes, I rewrite the URLs through web.config:

<rule name="categories_1" stopProcessing="true">
<match url="category1/(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/category1.cfm?id={R:1}" />
</rule>

When I land on this page, Coldfusion returns an error: "LINK_DECODE undefined variable." But, if I try to include the cfscript file on the Coldfusion page, you get an error: "Routines cannot be declared more than once. The link_decode routine has been declared twice in different templates." This tells me that the procedure is available, so why not find it?

Updating Ooops ... My Fault ... I called the function before it was included in the page ... Spirit.

+4
1

... cfml... link_decode? ? , , .., , cfscript. , .

+1

Source: https://habr.com/ru/post/1524386/