$value) { if (preg_match('/.+\"VALUE\"\;s\:\d*\:\".+\"\;\}$/', $info['town_facts'][$key])) { $info['town_facts'][$key] = preg_replace('/.+\"VALUE\"\;s\:\d*\:\"(.+)\"\;\}$/', '$1', $value); } else { $info['town_facts'][$key] = "N/A"; } } $countyLink = strtolower($info['town_facts']['option_9']); $senate = explode(",", $info['town_facts']['option_11']); $house = explode(",", $info['town_facts']['option_12']); $senateAll = array(); foreach ($senate as $key => $value) { array_push($senateAll, $value); } $houseAll = array(); foreach ($house as $key => $value) { array_push($houseAll, $value); } ////////////////////////////////////////////// // get town contact information ////////////////////////////////////////////// $query = @mysql_query( "SELECT * FROM pages, published_page_values, towns WHERE towns.town_id='$town' AND pages.page_town_id=towns.town_id AND published_page_values.page_value_page_id=pages.page_id AND published_page_values.page_value_template_modules_id='5' AND published_page_values.page_value_module_option_id IN ( '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30' ) ORDER BY published_page_values.page_value_module_option_id" ) or die(ERROR_MESSAGE); while ($row = mysql_fetch_assoc($query)) { $info['contact_info']['option_' . $row['page_value_module_option_id']] = $row['page_value_data']; } foreach ($info['contact_info'] as $key => $value) { $info['contact_info'][$key] = preg_replace('/.+\"VALUE\"\;s\:\d*\:\"(.+)\"\;\}$/', '$1', $value); } // reformat the phone/fax numbers $info['contact_info']['option_24'] = preg_replace('/(\d{3})(\d{3})(\d{4})/', '($1) $2-$3', $info['contact_info']['option_24']); $info['contact_info']['option_25'] = preg_replace('/(\d{3})(\d{3})(\d{4})/', '($1) $2-$3', $info['contact_info']['option_25']); // set to N/A if its....well...N/A if (preg_match('/^\s*$/', $info['contact_info']['option_24'])) { $info['contact_info']['option_24'] = "N/A"; } if (preg_match('/^\s*$/', $info['contact_info']['option_25'])) { $info['contact_info']['option_25'] = "N/A"; } // check the official web site link if ($info['contact_info']['option_26']) { if (!preg_match('/^http\:\/\//i', $info['contact_info']['option_26'])) { $info['contact_info']['option_26'] = "http://".$info['contact_info']['option_26']; } $info['contact_info']['option_26'] = "

Website: Official Website

"; } // build map it link $mapit = "https://www.maine.gov/local/town.php?show=queryParam&"; $mapit .= "address=".$info['contact_info']['option_20']."&"; $mapit .= "city=".$info['contact_info']['option_21']."&"; $mapit .= "state=ME&"; $mapit .= "zip=".$info['contact_info']['option_23']."&"; $mapit .= "name=Town of $townName&"; $mapit .= "t=".$townName; ////////////////////////////////////////////// // get the county online services ////////////////////////////////////////////// $query = @mysql_query( "SELECT * FROM pages, published_page_values, towns WHERE towns.town_id='$town' AND pages.page_town_id=towns.town_id AND published_page_values.page_value_page_id=pages.page_id AND page_value_template_modules_id='6' AND published_page_values.page_value_module_option_id='29' ORDER BY published_page_values.page_value_module_option_id" ) or die(ERROR_MESSAGE); while ($row = mysql_fetch_assoc($query)) { $info['town_services']['option_' . $row['page_value_module_option_id']] = $row['page_value_data']; } foreach ($info['town_services'] as $key => $value) { preg_match_all('/\"(\d+)\"/', $value, $out); } $services = join(",", $out); foreach ($out[1] as $key => $value) { $values .= "'$value',"; } $values = preg_replace('/,$/', '', $values); $links = ''; print ""; if (!preg_match('/^\s*$/', $values)) { print ""; $query = @mysql_query( "SELECT * FROM online_services WHERE online_service_id IN($values)" ) or die(ERROR_MESSAGE); $i = 0; $info['town_services'] = array(); while ($row = mysql_fetch_assoc($query)) { $links .= "

" . $row['online_service_name'] . "

"; $info['town_services'][$i]['service'] = $row['online_service_name']; $info['town_services'][$i]['url'] = $row['online_service_url']; $i++; } } $links .= "

Trailer Renewal

"; ?> Local: Maine.gov
  1. Home
  2. » Local

Local

Town of

Online Services

Town Facts

County: ";?>

School Dist/Dept:

For more information about voting districts and elected officials related to please visit the voter lookup service provided by the Secretary of State.

Contact Information

Address:

,
Map It

Tel:

Fax:

" . polling_places_dd($town) . " "; } elseif ($_REQUEST['show'] === 'lib') { echo "
" . libaries_dd($town) . " "; } elseif ($_REQUEST['show'] === 'twnoff') { echo "
" . town_offices_dd($town) . " "; } ?>