Language .'/langHTML.php'); const GEOIP_LOCATION = '/home/www/secure.mortgagecalculator.org/htdocs/includes/geoip/'; // full path to geoip include_once( GEOIP_LOCATION . 'geoip.php'); // need to include only once $userLocation = UserLocation\getLocation( $_SERVER['REMOTE_ADDR'], GEOIP_LOCATION . 'db/GeoIP2-City-North-America.mmdb' ); // also, should be called once if (!class_exists('smarty')) include_once('libs/Smarty.class.php'); include_once('functions.php'); // Including common header include('templates/'. $Variables->Template .'/header.php'); $CalcContent = _show_form(); // Including common footer from the templates directory include('templates/'. $Variables->Template .'/footer.php'); function _show_form() { // Making required variables visible into this function. global $Variables, $CalcSettings; global $userLocation; // Creating a Smarty class instance and assigning values array to it. $smarty = new Smarty(); $smarty->assign('lang', $Variables->LangVar); $smarty->assign('settings', $CalcSettings); $smarty->assign('city', $userLocation['city']); $smarty->assign('zip', $userLocation['zip']); $smarty->assign('state', $userLocation['state']); $smarty->assign('location_usa', $userLocation['location_usa']); if (isset($PdfSettings)) $smarty->assign('pdfSettings', $PdfSettings); $content = $smarty->fetch($Variables->Template.'/index.tpl'); // Displaying form with values or returning content if ($CalcSettings->ReturnContent) return $content; else echo $content; } ?>