Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Stamp_Guy's scratchpad

by Stamp_Guy (Monk)
on Jun 01, 2004 at 21:50 UTC ( [id://358647]=scratchpad: print w/replies, xml ) Need Help??

#!/usr/bin/perl -w use strict; use CGI qw(:standard); my $query = new CGI; use CGI::Carp qw(fatalsToBrowser); ##################################################################### # DESCRIPTION ##################################################################### # The purpose of this script is to provide a simple way to switch # between the French and English versions of a website. In order to # function properly, the script requires that a standard naming # convention be used on both the French and English versions of the # website. ##################################################################### # CONFIGURATION ##################################################################### my %OPTIONS = ( en_extension => '_e', fr_extension => '_f', en_directory => 'en', fr_directory => 'fr', ); ##################################################################### # PLEASE DO NOT MODIFY ANYTHING BELOW THIS LINE ##################################################################### # Switch to English or French? my $lang = $query->param('lang'); # The http address of the page calling this script my $referrer = $query->referer; # Initialize the $final_url variable my $final_url = "$referrer"; # Change the $final_url variable as per instructions stored in the # $lang variable if ($lang eq "en") { $final_url =~ s/$OPTIONS{'fr_directory'}/$OPTIONS{'en_directory'}/ +i; $final_url =~ s/$OPTIONS{'fr_extension'}\.html/$OPTIONS{'en_extens +ion'}\.html/i; } elsif ($lang eq "fr") { $final_url =~ s/$OPTIONS{'en_directory'}/$OPTIONS{'fr_directory'}/ +i; $final_url =~ s/$OPTIONS{en_extension}\.html/$OPTIONS{fr_extension +}\.html/i; } # Go to the page requested print $query->redirect("$final_url");
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-12-03 04:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found