Re: quick ref
| From: | Gonzalo Vera | Date: | Wed, 18 Oct 2000 22:00:06 +0000 |
| Subject: | Re: quick ref | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-3357@lists.php.net to get a copy of this message | ||
> does anybody know if the quick ref function on the www.php.net site
> or another similiar pacakage is available for download anywhere? the
> quick ref is an awesome help when you're a newbie, but it costs to
> much money to be hooked up to the net the entire time...
Try this. Place this script (manualsearch.php) in the same directory
as your downloaded php manual. It's very simple, but works ok.
<?php
// Define your user manual path (not needed if you place this script in the manual's dir)
$basedir="./";
$handle=opendir($basedir);
echo "
<HTML>
<HEAD>
<TITLE>PHP Manual Search</TITLE>
</HEAD>
<BODY>
<A HREF='manual.html'>Manual Index</A>
<FORM ACTION='manualsearch.php' METHOD='GET'>
<INPUT TYPE='TEXT' NAME='keyword'>
<INPUT TYPE='Submit'>
</FORM>
";
if ($keyword) {
$count=1;
while (false!==($file[$count] = readdir($handle))) {
if (ereg($keyword,$file[$count])) {
echo "<A
HREF='$file[$count]'>".substr(str_replace(".","-",$file[$count]),0,-5)."<A><BR>";
}
$count++;
}
closedir($handle);
}
?>
---------------------------
You can even include this:
<FORM ACTION='manualsearch.php' METHOD='GET'>
<INPUT TYPE='TEXT' NAME='keyword'>
<INPUT TYPE='Submit'>
</FORM>
In your "manual.html", someplace in the header, so you can call the
search from the php manual index.
The search is done by filename using ereg(), so you can use regular
expresions for your search.
Any better ideas or enhancements?
Gonzalo.