|Classes of Gert Massheimer
|Website PHP Full Text Search
SearchClass - Full Text Search for Websites
The SearchClass is a full text search for websites with multiple pages. It works with HTML or PHP based sources. The class can be extended with your own templates and/or your translations.
The class is full of comments and should be self-explanatory.
![Search Result Page][image-1]
How it works
After calling the class by using a form (which is part of the HTML-template), the class will start a search according to the given folders.
For the initial search filters will be applied:
The search limiters:
Will also work inside PHP-code by applying the standard PHP comment in front or around it.
All relevant file-paths will be stored in an array then the files will be searched again and a text excerpt will be extracted. Finally the search results will be displayed in Google-style result page.
There are two options to display the page title:
There are also two options to display the page description:
In both cases, the PHP variable will overwrite the meta-tag, if it exists, too.
If no limiter is found inside a source, *ALL* text will be searched and used for the initial search!
But for the text excerpt itself, all filters will be applied before displaying it.
At the end of the main class or its extension is the template included that displays the result page. Make sure you include the template only ones. If you don't extend the main class, include the template there. If you extend the main class, include the template in its extension.
The minimum PHP version is 7.4