Making A Plugin Searchable
From e107 Wiki
e107 Wiki: English | Русский | Deutsch | Français | Magyar | Português | Български | Česky | Nederlands | Ελληνικά | Italiano | Norske | Polska | Slovenščina | Español | Svenska | Translate: Wiki | Page
Making A Plugin SearchableThis guide describes how to add your plugin to the core e107 search functionality. It also shows you how you can add a search text box to your plugins page(s). e_search.phpCreate a file called e_search.php in your plugin folder. It must be called this as it is a well known file name that is looked for in each plugin folder.
search.phpCreate a file called search.php (or whatever you called the file in the 'sfile' array element in your e_search.php file). The following example is adapted from the Election plugin. Note: you must define all these variables, even if they are blank, to prevent contamination of bad values from other plugins' search modules.
search.php (old style)This is an older way of defining a search results file. However, it is still valid code and can be used in preference to the newer method (above). Create a file called search.php (or whatever you called the file in the 'sfile' array element in your e_search.php file). The following example is adapted from the Userjournals plugin.
Here's a rundown of what's happening in this file.
Note that the English text should really be localized and put in a language file. advanced_search.phpNot sure of all the options for this file yet. This is just the Content Manager plugin advanced search file for now.
Adding A Search Text BoxYou can add a search text box - so users can search directly from your plugins page(s) by adding some simple HTML (but see notes after sample code).
This will give you a text box where the user can type in their search term and press Enter/Return to start the search. Note: In practice this does not work too well. This is because the hidden field Also, as mentioned, the English text should really come from a language file. Note: You must create a plugin.php file and install your plugin through the e107 Plugin Manager. This allows e107 to register your plugin in the e107_core/search_prefs table so that e107_search will include it in it's searchable modules. Searching Comments in your PluginMany third party plugins allow comments to be posted on records in the plugin. To be able to search these comments you need to create a file called search_comments.php. Following the e107 convention of putting all search related scripts into a sub directory called search this example assumes that file path is used.The search_comments.php file should be found on plugin installation or with a tools-database-scan plugin directories.
| ||||||||||||||||||||

