Treasury Board of Canada, Secretariat - Government of Canada
Skip all menus Skip first menu
,  Français  Contact Us  Help  Search  Canada Site
     What's New  About Us  Policies  Documents  TBS Site
   Calendar  Links  FAQs  Presentations  Home
,
Chief Information Officer Branch
Information, Privacy and Security Policy Division
Common Look and Feel for the Internet
Accessibility
Collaborative Arrangements
Cybersquatting
E-Mail
Important Notices
Navigation and Format
Official Languages
Internet Guide
Self-Assessment Guide
Toolbox

Find Information:
by Subject [ A to Z ] by Sub-site
Versions:  
Print Version Print Version
Related Subjects:
Common Look and Feel
Internet
Feedback on Website
,
,

How to information and coding,

Change Language Script in PERL

PURPOSE: minimalist script to toggle between _e.htm and _f.htm files or _e.html and _f.html files

CREATION DATE: 2000 08 31

NOTE: this works on our Netscape Enterprise Server (3.62SP1) on HP/UX 10.x and is used on http://jobs.gc.ca (the parts of the site with the new CLF look)

DISCLAIMER: This is script provided as an example only. You can modify it as needed.

# get the URL for the Web page that called this script
$calling_page = $ENV{'HTTP_REFERER'};
# when the browser is Netscape, the referrer can contain the # and anchor name: REMOVE IT! (eg. http://hostname/file.htm#anchorname)

if($calling_page =~ /(.*)\#.*/) {
    # only take the first part up to the #
    $calling_page = $1;}

# ignore any file that is not _e.htm or _f.htm and do nothing!

# is this an _e.htm file?

if($calling_page =~ /_e\.htm/) {
    # replace the suffix
    $calling_page =~ s/_e\.htm/_f\.htm/;
    print "Location: $calling_page\n\n";

# then is this an _f.htm file?

} elsif($calling_page =~ /_f\.htm/) {
    # replace the suffix
    $calling_page =~ s/_f\.htm/_e\.htm/;
    print "Location: $calling_page\n\n";}


Change Language .ASP Solution

Create an ASP page and name it language.asp. Store it in the root of your Web site. Include the following code before the HTML tag on the page.

<%@ LANGUAGE="VBSCRIPT" %>
<%
sString = Request.ServerVariables("HTTP_REFERER")
sFullFileName = Mid (sString, Instr (sString, ".asp"))
iLen = Instr (sString, ".asp")-2
sFileName = Mid (sString, 1, iLen)
sExtension = Mid (sString, iLen+1, 1)
if (sExtension = "e") Then
sExtension = "f"
else
sExtension = "e"
end if
sNewFileName= sFileName & sExtension & sFullFileName
Response.Redirect sNewFileName
%>


  ,
 Return to
Top of Page
Important Notices