Hi,
I made this small MOD for a client who wanted a database of their clients with addresses. He wanted to have a link on the bottom of every record that will bring up a map from mapquest.com with the address of the record.
For this to work, you must have 4 fields included in your .cfg file.
Address #This is the street address
City #This is the City
State #This is the State
Zip #This is the Zip Code
I.e.
'ID' => [ 0, 'numer', -1, 255, 0, '1', ''],
'Name' => [ 1, 'alpha', 20, 255, 0, '', ''],
'Address' => [ 2, 'alpha', 20, 255, 0, '', ''],
'City' => [ 3, 'alpha', 20, 255, 0, '', ''],
'State' => [ 4, 'alpha', 20, 255, 0, '', ''],
'Zip' => [ 5, 'numer', 20, 255, 0, '', '']
);
Once you have your fields set, go to your hmtl.pl file and add the following under
my (%rec) = @_; in the sub html_record routine.
$map_city = $rec{'City'};
$map_state = $rec{'State'};
$map_zip = $rec{'Zip'};
$map_street =~ s/ /\+/g;
$map_street =~ s/ /\+/g;
$map_street =~ s/&/ampersand/g;
$map_street =~ s/=/equalsign/g;
$map_city =~ s/ /\+/g;
$map_city =~ s/ /\+/g;
$map_city =~ s/&/ampersand/g;
$map_city =~ s/=/equalsign/g;
$map_state =~ s/ /\+/g;
$map_state =~ s/ /\+/g;
$map_state =~ s/&/ampersand/g;
$map_state =~ s/=/equalsign/g;
$map_zip =~ s/ /\+/g;
$map_zip =~ s/ /\+/g;
$map_zip =~ s/&/ampersand/g;
$map_zip =~ s/=/equalsign/g;
$map_url =
"http://www.mapquest.com/cgi-bin/mqfreeconnect?width=500&height=300&level=9&icontitles=no&style=2&streetaddress=$map_street&city=$map_city&s tate=$map_state&zip=$map_zip";
Whenever you want to print out the link to the map in html_record use
<a href="$map_url">Show Map</a>.
I hope this works for you. If you have any questions let me know.
Thanks
Eli
I made this small MOD for a client who wanted a database of their clients with addresses. He wanted to have a link on the bottom of every record that will bring up a map from mapquest.com with the address of the record.
For this to work, you must have 4 fields included in your .cfg file.
Address #This is the street address
City #This is the City
State #This is the State
Zip #This is the Zip Code
I.e.
Code:
%db_def = ( 'ID' => [ 0, 'numer', -1, 255, 0, '1', ''],
'Name' => [ 1, 'alpha', 20, 255, 0, '', ''],
'Address' => [ 2, 'alpha', 20, 255, 0, '', ''],
'City' => [ 3, 'alpha', 20, 255, 0, '', ''],
'State' => [ 4, 'alpha', 20, 255, 0, '', ''],
'Zip' => [ 5, 'numer', 20, 255, 0, '', '']
);
Once you have your fields set, go to your hmtl.pl file and add the following under
my (%rec) = @_; in the sub html_record routine.
Code:
$map_street = $rec{'Address'}; $map_city = $rec{'City'};
$map_state = $rec{'State'};
$map_zip = $rec{'Zip'};
$map_street =~ s/ /\+/g;
$map_street =~ s/ /\+/g;
$map_street =~ s/&/ampersand/g;
$map_street =~ s/=/equalsign/g;
$map_city =~ s/ /\+/g;
$map_city =~ s/ /\+/g;
$map_city =~ s/&/ampersand/g;
$map_city =~ s/=/equalsign/g;
$map_state =~ s/ /\+/g;
$map_state =~ s/ /\+/g;
$map_state =~ s/&/ampersand/g;
$map_state =~ s/=/equalsign/g;
$map_zip =~ s/ /\+/g;
$map_zip =~ s/ /\+/g;
$map_zip =~ s/&/ampersand/g;
$map_zip =~ s/=/equalsign/g;
$map_url =
"http://www.mapquest.com/cgi-bin/mqfreeconnect?width=500&height=300&level=9&icontitles=no&style=2&streetaddress=$map_street&city=$map_city&s tate=$map_state&zip=$map_zip";
Whenever you want to print out the link to the map in html_record use
<a href="$map_url">Show Map</a>.
I hope this works for you. If you have any questions let me know.
Thanks
Eli