get_row($sql); $sql = "SELECT * FROM `location_new` WHERE id < $l_id ORDER BY id DESC LIMIT 1"; $rsBefore = $wpdb->get_row($sql); $sql = "SELECT * FROM `location_new` WHERE id > $l_id ORDER BY id LIMIT 1"; $rsAfter = $wpdb->get_row($sql); $total_rec_on_page=rand(5,record_per_page); $sql = "SELECT * FROM `location_new` WHERE parent_id='$l_id' ORDER BY rand() limit $total_rec_on_page"; $relatedLoc = $wpdb->get_results($sql, OBJECT); $tstring=""; $tstring=strtolower($rsBefore->location_name); preg_replace('/[^a-zA-Z0-9_ %\[\]\.\(\)%&-]/s', '-', $tstring); $tstring=str_replace("&","-",$tstring); $tstring=str_replace(" ","-",$tstring); $tstring=str_replace("--","-",$tstring); $tstring=str_replace("--","-",$tstring); if(!empty($rsBefore->id)) $linkBefore=WEB_PATH."category-location/$ctitle-c$c_id/$tstring-l".$rsBefore->id."#main"; $tstring=""; $tstring=strtolower($rsAfter->location_name); preg_replace('/[^a-zA-Z0-9_ %\[\]\.\(\)%&-]/s', '-', $tstring); $tstring=str_replace("&","-",$tstring); $tstring=str_replace(" ","-",$tstring); $tstring=str_replace("--","-",$tstring); $tstring=str_replace("--","-",$tstring); $linkAfter=WEB_PATH."category-location/$ctitle-c$c_id/$tstring-l".$rsAfter->id."#main"; //echo "
";
//print_r($rsLocation);

$sql = "select * from ".$wpdb->prefix."terms where term_id='".$c_id."'";
$rsCategory2 = $wpdb->get_results($sql, OBJECT);
$row_category="";
foreach ( $rsCategory2 as $key => $row_category2 )
{
	$row_category=$row_category2;
}
//echo "
";
//print_r($row_category);
//die();
$add_helping_verb="in";
if($rsLocation->location_type =="building")
	$add_helping_verb="near"; 

$c_l_title=ucwords(str_replace("-"," ",$l_title));
$c_ctitle=ucwords(str_replace("-"," ",$ctitle));

$loc_country="";
if($rsLocation->source_type =="uae"){
	$loc_country="United Arab Emirates";
}else if($rsLocation->source_type =="us"){
	$loc_country="United State";
}else if($rsLocation->source_type =="uk"){
	$loc_country="United Kingdom";
}else if($rsLocation->source_type =="ca"){
	$loc_country="Canada";
}


///////default setting
$page_heading=stripslashes(str_replace('__COUNTRY__',$loc_country,str_replace('__HELPING_VERT__',$add_helping_verb,str_replace('__LOCATION__',$c_l_title,str_replace('__CATEGORY__',$c_ctitle,str_replace('__SITENAME__',$site_url,CATEGORY_LOCATION_DETAIL_TITLE))))));
$page_description=stripslashes(trim(strip_tags(str_replace('__COUNTRY__',$loc_country,str_replace('__HELPING_VERT__',$add_helping_verb,str_replace('__LOCATION__',$c_l_title,str_replace('__CATEGORY__',$c_ctitle,str_replace('__SITENAME__',$site_url,CATEGORY_LOCATION_DETAIL_DESCRIPTION))))))));
$page_keywords=str_replace('__COUNTRY__',$loc_country,str_replace('__HELPING_VERT__',$add_helping_verb,str_replace('__LOCATION__',$c_l_title,str_replace('__CATEGORY__',$c_ctitle,str_replace('__SITENAME__',$site_url,CATEGORY_LOCATION_DETAIL_KEYWORDS)))));

$sql = "select * from location_setting limit 1";
$rslocation_setting = $wpdb->get_results($sql, OBJECT);
$row_location_setting="";

foreach ( $rslocation_setting as $key => $row_location_setting2 )
{  
	$row_location_setting=$row_location_setting2;
//	 echo '
';
//	print_r($row_location_setting);
 
	if(!empty($row_location_setting->browse_by_category_location_detail_title))
		 $page_heading=stripslashes(str_replace('__COUNTRY__',$loc_country,str_replace('__HELPING_VERT__',$add_helping_verb,str_replace('__LOCATION__',$c_l_title,str_replace('__CATEGORY__',$c_ctitle,str_replace('__SITENAME__',$site_url,$row_location_setting->browse_by_category_location_detail_title))))));
	if(!empty($row_location_setting->browse_by_category_location_detail))
		 $page_description=stripslashes(str_replace('__COUNTRY__',$loc_country,str_replace('__HELPING_VERT__',$add_helping_verb,str_replace('__LOCATION__',$c_l_title,str_replace('__CATEGORY__',$c_ctitle,str_replace('__SITENAME__',$site_url,$row_location_setting->browse_by_category_location_detail))))));	 
}


 
if($rsLocation->location_level ==0)
{
	if(!empty($row_category->template1_title))
		 $page_heading=stripslashes(str_replace('__HELPING_VERT__',$add_helping_verb,str_replace('__LOCATION__',$c_l_title,str_replace('__CATEGORY__',$c_ctitle,str_replace('__SITENAME__',$site_url,$row_category->template1_title)))));
	if(!empty($row_category->category_template1))
		$page_description=stripslashes(str_replace('__HELPING_VERT__',$add_helping_verb,str_replace('__LOCATION__',$c_l_title,str_replace('__CATEGORY__',$c_ctitle,str_replace('__SITENAME__',$site_url,$row_category->category_template1)))));
}else if($rsLocation->location_level ==1)
{
	
	if(!empty($row_category->template2_title))
		$page_heading=stripslashes(str_replace('__HELPING_VERT__',$add_helping_verb,str_replace('__LOCATION__',$c_l_title,str_replace('__CATEGORY__',$c_ctitle,str_replace('__SITENAME__',$site_url,$row_category->template2_title)))));
	if(!empty($row_category->category_template2))
		$page_description=stripslashes(str_replace('__HELPING_VERT__',$add_helping_verb,str_replace('__LOCATION__',$c_l_title,str_replace('__CATEGORY__',$c_ctitle,str_replace('__SITENAME__',$site_url,$row_category->category_template2)))));
}else{
 
	if(!empty($row_category->template3_title))
	$page_heading=stripslashes(str_replace('__HELPING_VERT__',$add_helping_verb,str_replace('__LOCATION__',$c_l_title,str_replace('__CATEGORY__',$c_ctitle,str_replace('__SITENAME__',$site_url,$row_category->template3_title)))));
	if(!empty($row_category->category_template3))
	$page_description=stripslashes(str_replace('__HELPING_VERT__',$add_helping_verb,str_replace('__LOCATION__',$c_l_title,str_replace('__CATEGORY__',$c_ctitle,str_replace('__SITENAME__',$site_url,$row_category->category_template3)))));
} 

$msg="";
$m_type="";
		
if(isset($_POST['btn_contact_form']))
{
	//echo "
";
	//print_r($_POST);
	add_contactus($_POST,$msg,$m_type,$t_type='general');
}


//print_r($_SESSION['captcha']);
?>