Login   Register  
PHP Classes
elePHPant
Icontem

File: search.html

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of nanou morgan  >  noticeboard  >  search.html  >  Download  
File: search.html
Role: ???
Content type: text/plain
Description: search the entries
Class: noticeboard
Author: By
Last change:
Date: 2001-02-11 09:24
Size: 3,020 bytes
 

Contents

Class file image Download
<?

include  ('template.inc');
include  ('variable.inc');


/*
------------------------------------------------------------------------
* Nanou Morgan                  Web  			http://www.vmedia.com.au            
* NoticeBoard version 1.1		Personal Web	http://www.nanou.com.au
* January 2001					Email: 			nanou@nanou.com.au
________________________________________________________________________

*/




if(!isset($submit)){
$title= "Search The Community Noticeboard";

$content .="<P><font face=\"Helvetica,Arial,Geneva\" size=\"2\"><b>$title</b></font><br><br>
<blockquote>
<form action=\"$PHP_SELF\" method=\"post\">

<input type=\"text\" name=\"keyword\" size=\"35\"><br>
<input type=\"reset\" name=\"reset\" value=\"Clear Keyword\"> || <input type=\"submit\" name=\"submit\" value=\"Search\">
</form></blockquote>";

}


if(isset($submit)){


$database = fopen ($noticeB_file, "r");
while (!(feof($database) ) ) {
$buffer = fgets($database, 4096);


$entry = explode("\t" , $buffer);
for ($k=0; $k<count($entry); $k++) {
						$CategoryN = strtr($entry[2], "_", " ");
						$AN =substr("$entry[0]",0,4);
						$MOIS =substr("$entry[0]",4,2);
						$JOUR =substr("$entry[0]",6,2);
						$entry[6]=stripslashes($entry[6]);
if (eregi("$keyword","$entry[$k]") == true){ $NewContent .= " <font face=\"Helvetica,Arial,Geneva\" size=\"2\"><b>$CategoryN</b>: <a href=\"list.html?Category=$entry[2]&ID=$entry[1]\">$entry[6]</a> - <i>(Posted on : $JOUR-$MOIS-$AN)</i></font></font><br>";
break;}

		}
		

	}
	
if ($NewContent==""){$NoContent .= "<font face=\"Helvetica,Arial,Geneva\" size=\"2\">There was no match to your keyword</font>";}

$title= "You have searched for $keyword";

$content .="<P><font face=\"Helvetica,Arial,Geneva\" size=\"2\"><b>$title</b></font><br><br>
<ul>$NewContent</blockquote>
<b>$NoContent </b>
<hr size=2 width=80%>
</ul>
<font face=\"Helvetica,Arial,Geneva\" size=\"2\"><b>You can perform a new search</b></font><br><br>
<form action=\"$PHP_SELF\" method=\"post\">
<input type=\"text\" name=\"keyword\" value=\"keyword\" size=\"35\"><br>
<input type=\"reset\" name=\"reset\" value=\"Clear Keyword\"> || <input type=\"submit\" name=\"submit\" value=\"Search\">
</form></blockquote>";

}



/*  parse to template */ 


$t = new Template( $path);
                                  // create a template object named $t 


$t->set_file( "MyFileHandle", "$template");
                                  // set MyFileHandle = our template file 
                                                                    
$t->set_var(array( "TITLE" => $title,
					"FOOTER" => $bot,
				   "CONTENT" =>  $content));
                                  

                                  // set template variable 
$t->parse( "MyOutput", "MyFileHandle"); 
                                  // set template variable MyOutput = parsed file 
$t->p( "MyOutput");  // output the value of MyOutput (our parsed data) 


?>