πŸš€ DevOps & SRE Certification Program πŸ“… Starting: 1st of Every Month 🀝 +91 8409492687 πŸ” Contact@DevOpsSchool.com

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

How to add live search functionality to your website?

With Php Custom Search, full-featured text search engine library written entirely in Php,javascript and xml. It is a technology suitable for nearly any application that requires full-text search.

step-1 First you create index.html page and adding some javascript code for using functionality livesearch.php page

<html>
<head>
<script>
function showResult(str) {
if (str.length==0) {
document.getElementById("livesearch").innerHTML="";
document.getElementById("livesearch").style.border="0px";
return;
}
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (this.readyState==4 && this.status==200) {
document.getElementById("livesearch").innerHTML=this.responseText;
document.getElementById("livesearch").style.border="1px solid #A5ACB2";
}
}
xmlhttp.open("GET","livesearch.php?q="+str,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form>
<input type="text" size="30" onkeyup="showResult(this.value)">
<div id="livesearch"></div>
</form>
</body>
</html>

step-2 Then you create livesearch.php page

<?php
$xmlDoc = new DOMDocument();
$xmlDoc->load("links.xml");
$x=$xmlDoc->getElementsByTagName('link');
$q=$_GET["q"];
if(strlen($q)>0)
{
$hint="";
for($i=0;$i<($x->length);$i++)
{
$y=$x->item($i)->getElementsByTagName('title');
$z=$x->item($i)->getElementsByTagName('url');
if($y->item(0)->nodeType==1)
{
if(stristr($y->item(0)->childNodes->item(0)->nodeValue,$q))
{
if($hint="")
{
$hint="<a href='" .
$z->item(0)->childNodes->item(0)->nodeValue.
"' target='_blank'>" .
$y->item(0)->childNodes->item(0)->nodeValue."</a>";
}
else
{
$hint=$hint . "<br/><a href='" .
$z->item(0)->childNodes->item(0)->nodeValue .
"' target='_blank'>".
$y->item(0)->childNodes->item(0)->nodeValue. "</a>";
}
}
}
}
}
if($hint==""){
$response = "No results found";
}
else
{
$response = $hint;
}
echo $response;
?>

step-3 Then you create links.xml file links.xml is used for linking with search data.

view raw links.xml hosted with ❀ by GitHub

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.