brunobliss Posted June 3, 2011 Share Posted June 3, 2011 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? Link to comment https://forums.phpfreaks.com/topic/238342-need-a-search-engine-that-will-search-my-php-files/ Share on other sites More sharing options...
Fadion Posted June 3, 2011 Share Posted June 3, 2011 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. Link to comment https://forums.phpfreaks.com/topic/238342-need-a-search-engine-that-will-search-my-php-files/#findComment-1224879 Share on other sites More sharing options...
WebStyles Posted June 3, 2011 Share Posted June 3, 2011 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. Link to comment https://forums.phpfreaks.com/topic/238342-need-a-search-engine-that-will-search-my-php-files/#findComment-1224926 Share on other sites More sharing options...
Pikachu2000 Posted June 3, 2011 Share Posted June 3, 2011 When posting code, please enclose it within the forum's . . . BBCode tags. Link to comment https://forums.phpfreaks.com/topic/238342-need-a-search-engine-that-will-search-my-php-files/#findComment-1224931 Share on other sites More sharing options...
WebStyles Posted June 3, 2011 Share Posted June 3, 2011 Sorry about that. Thanks for fixing it. Link to comment https://forums.phpfreaks.com/topic/238342-need-a-search-engine-that-will-search-my-php-files/#findComment-1224932 Share on other sites More sharing options...
brunobliss Posted June 7, 2011 Author Share Posted June 7, 2011 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. Link to comment https://forums.phpfreaks.com/topic/238342-need-a-search-engine-that-will-search-my-php-files/#findComment-1226385 Share on other sites More sharing options...
teynon Posted June 7, 2011 Share Posted June 7, 2011 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. Link to comment https://forums.phpfreaks.com/topic/238342-need-a-search-engine-that-will-search-my-php-files/#findComment-1226393 Share on other sites More sharing options...
brunobliss Posted June 7, 2011 Author Share Posted June 7, 2011 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 Link to comment https://forums.phpfreaks.com/topic/238342-need-a-search-engine-that-will-search-my-php-files/#findComment-1226754 Share on other sites More sharing options...
teynon Posted June 7, 2011 Share Posted June 7, 2011 It sounds like your web site operates like this: index.php?page=1 index.php?page=2 Which I don't recommend, but I do believe google will index it that way still. Link to comment https://forums.phpfreaks.com/topic/238342-need-a-search-engine-that-will-search-my-php-files/#findComment-1226763 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.