Rah's Link Search
Extends Textpattern’s search to links.
Version 0.4 Jan 29, 2012
Other versions...
A cup of coffee
via PayPal
List of features
- Search results are customizable with Textpattern’s link forms.
- A simple tag,
<txp:rah_link_search />
. The tag shows search results. - The search works with the standard core
?q
HTTP GET search. Core conditionals and forms can work too, including<txp:if_search />
.
Requirements
- PHP 4.3.0+
- Textpattern 4.3.0+
Installation and usage
The general behavior stands: paste plugin code to the plugin installer textarea and run the automatic setup. When done, just activate the plugin and you are ready to use the new tag, <txp:rah_link_search />
.
You can now use <txp:rah_link_search />
to display links on your search results page. It works same as <txp:article />
would.
Attributes
The tag is <txp:rah_link_search />
and attributes for it follow.
form
Textpattern’s link form used to display search results.
Example: form="linkform"
Default: "plainlinks"
wraptag
The (X)HTML tag, without brackets used to wrap the output. Default is unset.
Default: wraptag=""
Example: "div"
break
The (X)HTML tag (without brackets) or string to separate list items. Default is unset.
Default: break=""
Example: "br"
class
The (X)HTML class applied to the wraptag. Default is unset.
Default: class=""
Example: "plugin"
grand_total
Omit setting result count. If the attribute is set to "0"
(zero), search_result_count won’t be updated with the number of results. This attribute could be helpful if rah_link_search is used in conjunction with article tags, as article tags won’t update the count once it’s already set.
Default: grand_total="1"
Example: "0"
.
Examples
Example #1: Outputs search results (if any) and the search form.
<txp:search_input />
<txp:rah_link_search />
Example #2: Used as a container tag.
<txp:rah_link_search>
<h3><txp:link /></h3>
<p><txp:link_description /></p>
</txp:rah_link_search>
Changelog
Version 0.4
- Word mathcing is now identical with rah_file_search. Entries are matched for all searched words, not for any.
- In a container mode empty string is accepted as a wrapped content. Form isn’t fetched even when nothing is wrapped, as long as the tag is used as a container.
Version 0.3
- Searches are case-insensitive.
- Searches can match multiple words.
Version 0.2
- Added new attributes:
grand_total
,wraptag
,class
andbreak
. - Changed the matching syntax.
- Fixed query escaping.
- Now requires Textpattern version 4.3.0 or newer.
Version 0.1
- Initial release.