= 2) { // Get the last two parts of the host (e.g., "example.com") $domain = $hostParts[$numParts - 2] . '.' . $hostParts[$numParts - 1]; return $domain; } else { // If the host doesn't have at least two parts, return the entire host return $host; } } else { // If 'HTTP_HOST' is not set, return false return false; } } ?> '; echo ''; } ?> vimarsana; $newsdb = $db->news2021; $countvalue = 5; $skipcount = ($page-1) * $countvalue; $keys1 = explode(" ",$keys[0]); //$input = array("k"=>array('$and'=>$keys1)); //$input = array('k' => array('$all' => $keys1)); $input = array("k"=>$keys1[0]); $newsresults = $newsdb->find($input,array("limit"=>$countvalue,"skip"=>$skipcount)); $k = 0; $keywordsarray = array(); $keywordstring = ''; $newsresultsarrays = array(); foreach($newsresults as $newsresult2) { $newsresultsarrays[$k] = $newsresult2; $k = $k + 1; //echo "
" . $newsresult2['i']; if (isset($newsresult2['i'])) { if (($newsresult2['i'] != "") and ($imagefound == "")) { // echo "
" . $imagefound; $imagefound = $newsresult2['i']; $imagefound = str_replace("http://","https://",$imagefound); // break; } } if (isset($newsresult2['k'])) { foreach($newsresult2['k'] as $newskeyword) { array_push($keywordsarray,$newskeyword); } } } $keywordsarray = array_unique($keywordsarray); $keywordsarray = array_values($keywordsarray); foreach($keywordsarray as $keywordarr) { $keywordstring = $keywordstring . "," . ucfirst(str_replace("-"," ",$keywordarr)); } if ($imagefound == "") { $imagefound = "https://". $domain . "/images/vimarsana-bigimage.jpg"; } $newsarrayscount = count($newsresultsarrays); $keywords = "Live Updates, Breaking News on " . $t . $keywordstring; ?> <?php echo ucwords($title) ?> '; } ?>
'; } echo "

" . $title . "

"; if ($newsarrayscount > 0) { $v = 0; $keywordsarray = array(); $newscount = 0; foreach ($newsresultsarrays as $newsresult) { if (isset($newsresult['d'])) { $newsdate = $newsresult['d']; } else { $newsdate = date("Y-m-d"); } if (isset($newsresult['s'])) { $newsresult['u'] = "https://" . $domain . "/amparticle/" . $newsresult['u'] ; $url = "https://" . $domain . "/amparticle/" . $newsresult['s'] ; } else { $newsresult['u'] = "https://" . $domain . "/amparticle/" . $newsresult['u'] ; $url = "https://" . $domain . "/amparticle/" . $newsresult['u'] ; } $newstitle = ''; if (isset($newsresult['t'])) { $newstitle = $newsresult['t']; } $keywords = $newsresult['k']; $imagefound = 'https://' . $domain . '/images/vimarsana-bigimage.jpg'; if (isset($newsresult['do'])) { } else { $newsresult['do'] = $domain ; } if (isset($newsresult['i'])) { $imagefound = $newsresult['i']; } else { $newsresult['i'] = $imagefound; } $image = $imagefound; $v = $v +1 ; echo '
'; echo '

' . $newstitle. '

'; if ((isset($newsresult['de'])) and ($newsresult['de'] != "")) { $pos1 = strpos($newsresult['de'],"{"); $newsresult['de'] = strip_tags($newsresult['de']); $pos = strpos($newsresult['de'],"