Other Added
#1 in Business Subscribe Email Print

You are here: Home > Internet and Businesses Online > Web Development > Design a Search Engine for Your Own Site with PHP

Tags

  • whether
  • variable
  • process files
  • called searchphp
  • function listfilesdirkeywordarrayhandleopendirdir

  • Links

  • Ginger for Upset Stomach
  • A Guide To The Weather In Malaga Spain
  • Safety Equipment for Easy BMX Tricks
  • Other Added - Design a Search Engine for Your Own Site with PHP

    Find Your Passion!
    For a arts and crafts business to survive and prosper, you have to love what you are doing..You need to be passionate about your craft, in order to sell to potential customers, especially at craft shows, where you are face to face with the customer...A lot of people, visit craft shows and craft stores, and think "Oh I could do that,".. promptly go home and try to mass produce a craft, set up a table and sit in a chair ... waiting for the customers to show up.. If this is you, then STOP right now... because its not going to work!.. The customer can spot you a mile away, and it will probably show in your products.. the quality and the pride will not be there..!Once you have found your passion, or your arts and craf
    ."&&$file!=".."){

    //if it is a directory, then continue

    if(is_dir("$dir/$file")){

    listFiles("$dir/$file");

    }

    else{

    //process the searching here with the following PHP script

    }

    }

    }

    }

    ?> The following scripts read, process files and check whether the files contain $keyword. If $keyword is found in the file, the file address will be saved in an array-type variable.

    function listFiles($dir,$keyword,&$array){

    $handle=opendir($dir); Popcorn and Other Marketing Mistakes In a Changing Economy
    Ten years of competitive hell!That was the title on the seminar brochure I received recently. As I survey some of the forces flowing through our economy, and witness the way in which they effect my clients, I have to agree. The Information Age is certainly one of the most turbulent times business people have ever seen.And the force causing the greatest turbulence is rapid, unrelenting change. Consider this. In 1900, the total amount of knowledge that mankind had was doubling about every 500 years. Today, it doubles about every two years. And the pace continues to increase. One futurist predicts that today's high school seniors will have to absorb more information in their final year alone than their grandparents did in the

    This hands on PHP Programming article provides the knowledge necessary to design and develop a search engine for your website using PHP version 4.0 and above. Making a search engine for your website with PHP is really easy and provides substantial functionality required by most of the small to medium websites. This article introduces every steps of the development, including both design and PHP programming. Basic computer skills and knowledge of HTML fundamentals are required. Ok, let's begin now.

    Step 1: Design Search Box

    Under your website root, make a file called search.htm or anything you like and type in the following code:

    <html>

    <head>

    <title>Web Search</title>

    <meta http-equiv="Content-Type" content="text/html">

    </head>

    <body bgcolor="#FFFFFF" text="#000000">

    <form name="form1" method="post" action="search.php">

    <table width="100%" cellspacing="0" cellpadding="0">

    <tr>

    <td width="36%">

    <div align="center">

    <input type="text" name="keyword">

    </div>

    </td>

    <td width="64%">

    <input type="submit" name="Submit" value="Search">

    </td>

    </tr>

    </table>

    </form>

    </body>

    </html>

    Step 2: Write search.php file. It is the core of your website search engine.

    Under your website root, create a file called search.php or anything you like.

    //get keywords

    $keyword=trim($_POST["keyword"]);

    //check if the keyword is empty

    if($keyword==""){

    echo"no keywords";

    exit;

    }

    ?>

    With above, you can give hints to your users when they forget to enter a keyword. Now let's go through all the files or articles in your website.

    function listFiles($dir){

    $handle=opendir($dir);

    while(false!==($file=readdir($handle))){

    if($file!="."&&$file!=".."){

    //if it is a directory, then continue

    if(is_dir("$dir/$file")){

    listFiles("$dir/$file");

    }

    else{

    //process the searching here with the following PHP script

    }

    }

    }

    }

    ?>

    The following scripts read, process files and check whether the files contain $keyword. If $keyword is found in the file, the file address will be saved in an array-type variable.

    function listFiles($dir,$keyword,&$array){

    $handle=opendir($dir); Business Process Innovation
    Outsourcing Success MantraManagers managing successful outsourcing relationships increasingly believe that success is tightly bound to the ability to adopt and exploit practices that drive sustained process innovations/ improvement. Such business processes innovations are characterized by a no-holds barred commitment to the overall business goals and hence are aligned to individual skills/competencies. Along with today's leading edge technological resources like ERP, new process modelling techniques provide the means to sustain continuous innovation.Outsourcing experts and project managers now look to implement processes that directly address critical business needs, recognizing the cross-organizational nature>Under your website root, make a file called search.htm or anything you like and type in the following code:

    <html>

    <head>

    <title>Web Search</title>

    <meta http-equiv="Content-Type" content="text/html">

    </head>

    <body bgcolor="#FFFFFF" text="#000000">

    <form name="form1" method="post" action="search.php">

    <table width="100%" cellspacing="0" cellpadding="0">

    <tr>

    <td width="36%">

    <div align="center">

    <input type="text" name="keyword">

    </div>

    </td>

    <td width="64%">

    <input type="submit" name="Submit" value="Search">

    </td>

    </tr>

    </table>

    </form>

    </body>

    </html>

    Step 2: Write search.php file. It is the core of your website search engine.

    Under your website root, create a file called search.php or anything you like.

    //get keywords

    $keyword=trim($_POST["keyword"]);

    //check if the keyword is empty

    if($keyword==""){

    echo"no keywords";

    exit;

    }

    ?>

    With above, you can give hints to your users when they forget to enter a keyword. Now let's go through all the files or articles in your website.

    function listFiles($dir){

    $handle=opendir($dir);

    while(false!==($file=readdir($handle))){

    if($file!="."&&$file!=".."){

    //if it is a directory, then continue

    if(is_dir("$dir/$file")){

    listFiles("$dir/$file");

    }

    else{

    //process the searching here with the following PHP script

    }

    }

    }

    }

    ?>

    The following scripts read, process files and check whether the files contain $keyword. If $keyword is found in the file, the file address will be saved in an array-type variable.

    function listFiles($dir,$keyword,&$array){

    $handle=opendir($dir); The Business Leader as Ultramarathoner
    Have you ever heard of an ultramarathon? A standard marathon is just over 26 miles. An ultramarathon is usually on the order of 50 or 100 miles, though there are some that span one thousand! Imagine the endurance required to run such a race.Running a business requires the kind of devotion and stamina that ultramarathoners can only dream about. Like the 100-mile runner, the successful business leader must maintain focus, keeping an eye on the path...on the mileposts that mark progress...and on the long-range goal.Unlike an ultramarathoner, your long-distance business run ends only when you leave the business by choice or when it dies an unnatural death. For in business the real success lies in creating something yo6%">

    <div align="center">

    <input type="text" name="keyword">

    </div>

    </td>

    <td width="64%">

    <input type="submit" name="Submit" value="Search">

    </td>

    </tr>

    </table>

    </form>

    </body>

    </html>

    Step 2: Write search.php file. It is the core of your website search engine.

    Under your website root, create a file called search.php or anything you like.

    //get keywords

    $keyword=trim($_POST["keyword"]);

    //check if the keyword is empty

    if($keyword==""){

    echo"no keywords";

    exit;

    }

    ?>

    With above, you can give hints to your users when they forget to enter a keyword. Now let's go through all the files or articles in your website.

    function listFiles($dir){

    $handle=opendir($dir);

    while(false!==($file=readdir($handle))){

    if($file!="."&&$file!=".."){

    //if it is a directory, then continue

    if(is_dir("$dir/$file")){

    listFiles("$dir/$file");

    }

    else{

    //process the searching here with the following PHP script

    }

    }

    }

    }

    ?>

    The following scripts read, process files and check whether the files contain $keyword. If $keyword is found in the file, the file address will be saved in an array-type variable.

    function listFiles($dir,$keyword,&$array){

    $handle=opendir($dir); Change Management and Your Future as an Executive
    In if you are up-and-coming in the business world and you find yourself in a position where change management is occurring very rapidly then you need to take the bull by the horns and take responsibility for the team. For those that have the ability to unite others in a real leadership this is the time for you to shine and your future as an executive in the corporation depends on it.All too often when change management occurs at the corporate level many of the folks in management sit back and wait for something to happen afraid to make any moves for fear that they might also get the ax or be asked to leave the company. This fear stifles innovation and hurts the efficiency of the organizational capital within the company.called search.php or anything you like.

    //get keywords

    $keyword=trim($_POST["keyword"]);

    //check if the keyword is empty

    if($keyword==""){

    echo"no keywords";

    exit;

    }

    ?>

    With above, you can give hints to your users when they forget to enter a keyword. Now let's go through all the files or articles in your website.

    function listFiles($dir){

    $handle=opendir($dir);

    while(false!==($file=readdir($handle))){

    if($file!="."&&$file!=".."){

    //if it is a directory, then continue

    if(is_dir("$dir/$file")){

    listFiles("$dir/$file");

    }

    else{

    //process the searching here with the following PHP script

    }

    }

    }

    }

    ?>

    The following scripts read, process files and check whether the files contain $keyword. If $keyword is found in the file, the file address will be saved in an array-type variable.

    function listFiles($dir,$keyword,&$array){

    $handle=opendir($dir); How to Run a Sales Blitz
    Despite the growing disdain for walk-in-the-door cold calling, there are plenty of high activity sales companies (even industries) that conduct sales blitzes to generate a wave of fresh leads for their new business developers.Read on for some great best practices to make them successful.Teams. I've always had good luck bringing approximately 8-10 people in for a sales blitz focused on one individual's sales territory. The 8-10 are paired up into teams (usually a senior sales professional with a newer one), and at the kick-off meeting early in the morning we announce the teams and they give themselves a fun name. Each team gets a binder with the next two helpful aids.Maps & Lists. Ea."&&$file!=".."){

    //if it is a directory, then continue

    if(is_dir("$dir/$file")){

    listFiles("$dir/$file");

    }

    else{

    //process the searching here with the following PHP script

    }

    }

    }

    }

    ?>

    The following scripts read, process files and check whether the files contain $keyword. If $keyword is found in the file, the file address will be saved in an array-type variable.

    function listFiles($dir,$keyword,&$array){

    $handle=opendir($dir);

    while(false!==($file=readdir($handle))){

    if($file!="."&&$file!=".."){

    if(is_dir("$dir/$file")){

    listFiles("$dir/$file",$keyword,$array);

    }

    else{

    //read file

    $data=fread(fopen("$dir/$file","r"),filesize("$dir/$file"));

    //avoid search search.php itself

    if($file!="search.php"){

    //contain keyword?

    if(eregi("$keyword",$data)){

    $array[]="$dir/$file";

    }

    }

    }

    }

    }

    }

    //define array $array

    $array=array();

    //execute function

    listFiles(".","php",$array);

    //echo/print search results

    foreach($array as $value){

    echo "$value"."
    n";

    } ?>

    Now, combine the codes listed above, all the related results in your websites will be found and listed.

    Step 3: further improvement of the search engine can be made by adding the following,

    (1) list the title of all searching results

    REPLACE THE FOLLOWING

    if(eregi("$keyword",$data)){

    $array[]="$dir/$file";

    }

    WITH

    if(eregi("$keyword",$data)){

    if(eregi("(.+)</p><p>",$data,$m)){

    $title=$m["1"];

    }

    else{

    $title="no title";

    }

    $array[]="$dir/$file $title";

    }

    (2) Add links to searching results

    CHANGE THE FOLLOWING

    foreach($array as $value){

    echo "$value"."
    n";

    }

    TO
    foreach($array as $value){

    list($filedir,$title)=split("[ ]",$value,"2");

    echo "<a href=$filedir>$value</a>"."<br>";

    }

    (3) Set time limit for PHP execution

    ADD THE FOLLOWING AT THE BEGINNING OF PHP FILES

    set_time_limit("600");
    The above time unit is second. 10 minutes is the script execution litmit.

    Combine all the above codes and get the complete search.php file as following,

    set_time_limit("600");

    $keyword=trim($_POST["keyword"]);

    if($keyword==""){

    echo"Please enter your keyword";

    exit; }

    fun

    HTTP = HTML link (for blogs, profiles,phorums):
    <a href="http://www.otheradded.com/article/87313/otheradded-Design-a-Search-Engine-for-Your-Own-Site-with-PHP.html">Design a Search Engine for Your Own Site with PHP</a>

    BB link (for phorums):
    [url=http://www.otheradded.com/article/87313/otheradded-Design-a-Search-Engine-for-Your-Own-Site-with-PHP.html]Design a Search Engine for Your Own Site with PHP[/url]

    Related Articles:

    What's in an Ad?

    Advance Your Career

    How to Achieve Social Bookmarking Success

    Bookmark it: del.icio.us digg.com reddit.com netvouz.com google.com yahoo.com technorati.com furl.net bloglines.com socialdust.com ma.gnolia.com newsvine.com slashdot.org simpy.com shadows.com blinklist.com