Jump to content

need a search engine that will search my php files


brunobliss

Recommended Posts

Hey guys, i'm developing a basic website which consists in a 9 button menu, each button calls a php which will include the menu on top, this is the code:

 

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<p align="center">
<img border="0" src="recordsbaylogo_lo.png" width="258" height="87"></p>
<table border="0" align="center" width="80%">
<tr>
	<td align="center"><font face="Calibri"><a href="abc.php">A-B-C</a></font></td>
	<td align="center"><font face="Calibri"><a href="def.php">D-E-F</a></font></td>
	<td align="center"><font face="Calibri"><a href="ghi.php">G-H-I</a></font></td>
	<td align="center"><font face="Calibri"><a href="jkl.php">J-K-L</a></font></td>
	<td align="center"><font face="Calibri"><a href="mno.php">M-N-O</a></font></td>
	<td align="center"><font face="Calibri"><a href="pqr.php">P-Q-R</a></font></td>
	<td align="center"><font face="Calibri"><a href="stu.php">S-T-U</a></font></td>
	<td align="center"><font face="Calibri"><a href="vwx.php">V-W-X</a></font></td>
	<td align="center"><font face="Calibri"><a href="yz0.php">Y-Z-0</a></font></td>
</tr>
</table>

</body>
</html>

 

what i need now is some search engine that will browse keywords through the alphabetic php's. Should be easy no?

Hmm... you need a search engine for PHP files? What in the world you need it for? You mean filenames or file contents?

 

Anyway, you better explain what you're trying to do here, because the logic seems quite off in the first place.

I also don't really get exactly what you want, but....

while you're at it, you can also simplify this:

<td align="center"><font face="Calibri"><a href="abc.php">A-B-C</a></font></td>
      <td align="center"><font face="Calibri"><a href="def.php">D-E-F</a></font></td>
      <td align="center"><font face="Calibri"><a href="ghi.php">G-H-I</a></font></td>
      <td align="center"><font face="Calibri"><a href="jkl.php">J-K-L</a></font></td>
      <td align="center"><font face="Calibri"><a href="mno.php">M-N-O</a></font></td>
      <td align="center"><font face="Calibri"><a href="pqr.php">P-Q-R</a></font></td>
      <td align="center"><font face="Calibri"><a href="stu.php">S-T-U</a></font></td>
      <td align="center"><font face="Calibri"><a href="vwx.php">V-W-X</a></font></td>
      <td align="center"><font face="Calibri"><a href="yz0.php">Y-Z-0</a></font></td>

into something like this:
<?php
$buttons = array("A-B-C","D-E-F","G-H-I","J-K-L","M-N-O","P-Q-R","S-T-U","V-W-X","Y-Z-0");
foreach($buttons as $b){
  echo '<td align="center"><font face="Calibri"><a href="'.strtolower(str_replace("-","",$b)).'.php">'.$b.'</a></font></td>';
}
?>

then, if what you want to search is a specific letter and load the correct page, all you need to do is search the array values for the letter you want, something like: (searching for letter F as an example)

<?php
$find = 'F';
foreach ($buttons as $b){
if(strpos($b,$find)) echo 'Found '.$find.' IN PAGE '.strtolower(str_replace("-","",$b)).'.php'; 
}
?>

 

MOD EDIT: code tags added.

Hmm... you need a search engine for PHP files? What in the world you need it for? You mean filenames or file contents?

 

Anyway, you better explain what you're trying to do here, because the logic seems quite off in the first place.

 

thank you guys for the replies i'm definitely going to try your suggestions.

 

I got my site up and running yesterday, the search feature is not a priority since a simple CTRL+F would solve any major problems, but still, for those who didn't understand what i need, just take a look:

 

http://recordsbay.pt.vu

 

It would be cool to have a search engine that would display the results of words written in the *_contents.php files, let me explain the way i done this, when you click A-B-C link on the menu it directs you to abc.php which includes abc_contents.php which is a list of things i'm selling therefore updating constantly, thus the need of a search engine that will search the *_contents.php for keywords.

 

I'm aware that a shopping cart wold be easier and that also the way i built this may not work properly with a search engine, but this comes totally out of personal interest and wanting to learn a little bit more on the language and syntax.

 

 

brunobliss,

 

  You don't want your PHP files being searched because:

 

    1) There goes your security. If the search engine can index your code, you just broad casted all of your security holes.

    2) It doesn't make sense to index PHP files because variables change. You wouldn't get the actual content.

 

If you want the search engine to query different pages, you need to make separate pages. I do believe however, that google knows how to index pages using get variables.

brunobliss,

 

  You don't want your PHP files being searched because:

 

    1) There goes your security. If the search engine can index your code, you just broad casted all of your security holes.

    2) It doesn't make sense to index PHP files because variables change. You wouldn't get the actual content.

 

If you want the search engine to query different pages, you need to make separate pages. I do believe however, that google knows how to index pages using get variables.

 

i didn't quite get this last part, what do you mean? that page is a bunch of php's put together, included in each other

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.