Gossamer Forum
Home : Products : Links 2.0 : Customization :

Converting state abbreviations to full state names?

Quote Reply
Converting state abbreviations to full state names?
Hello,

I have a state field added in links.def and when a user fills in the submission form, I collect the state abbreviation and zip code etc.,

I would like to use the state abbreviation and display the full state name in the link.html and detailed.html etc., templates.

When I use the following in each of the subroutines, I am able to accomplish what I want. However, instead of using this each time in each sub, which makes the site_html_templates.pl file too long, I only want to use it once at the bottom.


if ($rec{'State'} eq 'AZ') {
$state_name = Arizona;
}
elsif ($rec{'State'} eq 'CA') {
$state_name = California;
}
elsif ($rec{'State'} eq 'CO') {
$state_name = Colorado;
}

and then in the "sub site_html_link" and other routines, pass on the state_name as state_name => $state_name,

to be able to show the full state names in corresponding templates with the tag <%state_name%>.

Can you help me finish the sub-routine to pass the state_name properly to corresponding subs and then I can use the <%state_name%> in corresponding templates to display the full state name?

Thanks

Last edited by:

socrates: Feb 25, 2004, 10:44 PM
Subject Author Views Date
Thread Converting state abbreviations to full state names? socrates 1984 Feb 25, 2004, 10:31 PM
Thread Re: [socrates] Converting state abbreviations to full state names?
fuzzy logic 1949 Feb 25, 2004, 10:58 PM
Post Re: [fuzzy logic] Converting state abbreviations to full state names?
socrates 1954 Feb 26, 2004, 4:44 PM