RSS Feed

Kau-Boy’s AutoCompleter Plugin

Veröffentlich am Donnerstag, 2. Jul 2009 in WordPress

Dieses Plugin verwendet den Ajax.Autocompleter von script.aculo.us bzw. die jQuery Autocomplete Funktoin um Beiträge zu finden, die den Suchbegriff im Titel oder Inhaltstext enthalten.

Der eingegebene Text kann in den Titel der Beiträge und/oder im Inhalt gesucht werden. Es kann zusätzlich die Formatierung der Ergebnisse über eine eigene CSS Datei an den Blog angepasst werden. Es kann jeweils der Titel oder zusätzlich ein Teil des Inhalts angegeben werden, wobei hier auch die Länge des auszugebenden Inhaltes eingestellt werden kann.

Installation:

Installation über die WordPress Adminstrator-Seiten:

  1. Gehe zur Admin-Seite Plugins -> Installieren
  2. Suche nach kau-boy und wähle das Plugin aus
  3. Wähle die Aktion Jetzt installieren
  4. Klicke auf Jetzt installieren
  5. Aktiviere das Plugin über den Plugins Menüpunkt in WordPress
  6. Du musst eventuell die Einstellungen anpassen, gerade wenn dein Suchfeld eine andere ID als s hat

Installation unter Verwendung der WordPress Adminstrator-Seiten:

  1. Lade die zip-Datei des Plugins herunter: kau-boys-autocompleter.2.2.zip
  2. Gehe zur Admin-Seite Plugins -> Installieren
  3. Wähle den Link Hochladen unter Plugins Installieren Überschrift
  4. Wähle die zip-Datei aus und klicke Jetzt installieren
  5. Aktiviere das Plugin über den Plugins Menüpunkt in WordPress
  6. Du musst eventuell die Einstellungen anpassen, gerade wenn dein Suchfeld eine andere ID als s hat

Installation unter Verwendung von FTP

  1. Lade die zip-Datei des Plugins herunter: kau-boys-autocompleter.2.2.zip
  2. Entpacke es und lade es in dein /wp-content/plugins/ Verzeichnis hoch
  3. Aktiviere das Plugin über den Plugins Menüpunkt in WordPress
  4. Du musst eventuell die Einstellungen anpassen, gerade wenn dein Suchfeld eine andere ID als s hat

Screenshots:

Screenshot des Plugins in einem neuen WordPress blog

Screenshot des Plugins

Screenshot der Einstellungsseite (auch in englisch erhältlich)

Screenshot der Einstellungsseite

Versionsgeschichte:

  • 2.2 Deaktivieren der Suche für Suchfelder im Adminbereich und Ermöglichen der Verwendung zusammen mit dem relevanssi Plugin
  • 2.1 Hinzufügen einer neuen Version von jQuery Autocomplete
  • 2.0.1 Entfernen von “short open tags”, die auf blogs die Fehler verursachen die “short_open_tag” nicht auf “On” gesetzt haben
  • 2.0 Autocompleter mit mehreren Textfelder auf einer Seite nutzbar machen, verbessern der Kürzung des Inhalt von Artikeln
  • 1.9 Beheben von Problemen mit PHP4, funktioniert nun auch mit qTranslate im “Query-Modus” (?lang=de)
  • 1.8 Hinzufügen der Einstellung für die Länge des Titels und des Inhalts in den Ergebnissen
  • 1.7 Erstzen von jQuery suggest durch jQuery autocomplete, da das suggest Plugin HTML Auszeichnungen zerstört
  • 1.6.1 Verwendung des id Attributs als Standard anstelle des name Attributs
  • 1.6 Hinzufügen der Möglichkeit das Suchfeldes anhand des name Atrrbiuts auszuwählen
  • 1.5.2 Hinzufügen der richtigen Kodierung zu html_entity_decode() um das Zerteilen von XML Enitäten zu verhindern
  • 1.5.1 Fehler im AJAX repsonse behoben, der die Einstellung für die Ergebnisfelder nicht geladen hat
  • 1.5 Hinzufügen Auswahlmöglichkeiten für die Such- und Ergebnisfelder
  • 1.4.1 Aktualisierung der Übersetzungsdatei
  • 1.4 Kombinieren der Styles für jQuery und script.aculo.us, Hinzufügen  einer Einstellung zur Multibyte-Kodierung
  • 1.3.5 Fehler bei der html_entity_decode() Konvertierung beseitigt
  • 1.3 Enfternen eines Kommentars in autocompleter.js.php, welcher eine PHP header warning  erzeugt hat
  • 1.2 Verwendung von html_entity_decode() um das Zerteilen von Enitäten zu verhindern
  • 1.1 Entfernen von WordPress shortcodes um leere oder falsche Seiten zu verhindern
  • 1.0 Möglichkeit jQuery ODER script.aculo.us zu verwenden, Übersetzen der Einstellungsseite ins Deutsche
  • 0.4 Hinzufügen der Einstellung für die Anzahl der Suchergebnisse und der eigenen CSS Date
  • 0.3 Hinzufügen der Einstellung für die Suchfeld ID
  • 0.2 Erste stabile Version

Wenn dir dieses Plugin gefällt oder dir etwas fehlt, würde ich mich freuen es zu erfahren. Hinterlasse einfach ein Kommentar auf dieser Seiter oder auf meiner WordPress Plugin Seite.

PayPal - The safer, easier way to pay online! PayPal - The safer, easier way to pay online!

  • Twitter
  • email
  • RSS
  • Facebook
  • MySpace
  • Google Bookmarks
  • MisterWong.DE
  • del.icio.us
  • LinkArena
  • Digg
  • Sphinn
  • Mixx
  • Reddit
  • Slashdot
  • Yigg
  • Technorati

Hinterlasse einen Kommentar

  1. We would like to use your plugin on a new wp-site using the latest atahualpa theme. seems not to work. any hints?
    thx marc

    • Bernhard sagt:

      Hi Marc,

      you are just a few hours to quick. I was searching for a diffrent theme for this blog and found out, that many themes doesn’t set the id attribute for the input field. I just installed the Atahualpa 3.4.1 theme to test it. This theme also uses only the name attribute.
      So after realising that many themes doesn’t have the needed id attribute I decided to add another option to be able to select the field by id or by name (or even another CSS selector).

      I have to test the new option with prototype and jQuery but I am pretty sure, that I will release the new version by tomorrow (maybe today).

      I hope this willl help not only you. Do you have any other ideas of how to improve the plugin?

      Bernhard

      • Hello Bernhard
        everthing works perfectly now with tha Atahualpa 3.4.1 theme!
        thank you very much for the great support!

        what i did:
        - updated the plugin to 1.6.1.
        in the plugin configuration:
        - changed the selectortype to name
        - changed the javascript Framework to jQuery

        that’s it. now it works

  2. Hans sagt:

    I have some weird behaviour when searching for either “di” or “no” (without the quotes.)

    It then parses the style of under wrong.

    If you want to reproduce try searching for: (di)splay or no(ne)on my website.

    • Bernhard sagt:

      Hi Hans,

      I could reproduce the problem. I use a default jQuery plugin for the autocomplete feature. This plugin doesn’t provides the feature of an onclick handler so I have to add the link the the article in a hidden span. To make it hidden I used inline formating with display: none. But the jQuery plugin seems to destroy HTML-Markup when hightlighting the found words.

      So I have to either find a new jQuery Plugin or I have to use single character markups and a diffrent CSS Layout for the results.

      I think I can give you an updated version this evening which than should work with jQuery as good as with scriptaculous. Until than you might use scriptaculous to avoid this problem.

      Bernhard

  3. Daniel sagt:

    In v1.8 I still get “Warning: cannot yet handle MBCS in html_entity_decode()! in /htdocs/wp-content/plugins/kau-boys-autocompleter/autocompleter_results.php on line 72″

    It was working great up until v1.5 and then it has stopped. Tried uninstalling / reinstalling – any further ideas?

    • Bernhard sagt:

      Hi Daniel,

      I search the web for your problem and it is a bug in PHP 4 (http://bugs.php.net/bug.php?id=27626). I use html_entity_decode to convert all characters to non-entities to avoid destroying them when limiting the title/content length.

      But as PHP 4 (pre 4.3.3) lacks a full support of UTF-8 it might be a prblem with the encoding. So the first thing you should try is to go to the settings page and change the multibyte encoding to ISO-8859-1.

      If that doesn’t work, try to replace line 72 in autocompleter_results.php. To do so, navigate to Plugins->Installed and click edit on the plugin. From the list at the right choose the autocompleter_results.php. Then replace this line:

      $str = html_entity_decode(trim($str), ENT_NOQUOTES, $encoding);

      with this line:

      $str = utf8_encode(html_entity_decode(trim($str)));

      As I don’t have a running Server with PHP4 I can’t test it myself right now.

      Bernhard

  4. Fiz sagt:

    Hi and thanks for your very beautiful plugin. One only thing about styling of autocompleter.css -> ac_result class:
    * add parameter left:-9999px; to disappear its border (if added) to the bottom of the page
    * add !important to width

    Bye!

  5. Sascha sagt:

    Unfortunately it does not work while Relevanssi is activated! I’s a pitty. Bothe plugins are valuable and nice! :) However, I will have to go for nice search results rather than for autocomplete…

    Anyway thanks for this nice plugin!

  6. [...] sinnvoll sofort den ersten Treffer zu selektieren) ist es ein spitzen Plugin. Außerdem sollte noch der tolle Einsatz des Autoren betont werden und dessen schnelle [...]

  7. Daniel sagt:

    I am using your plugin, how ever there is a delay between when start typing in a result and when the results get displayed. Is there any way to change this?

    • Bernhard sagt:

      If you have chosen Prototype as the framework the function is available as soon as the complete DOM is loaded if that takes some time the autocompletion is delayed. Try to switch the framework to jQuery if possible. But as the results have to be loaded with an AJAX call your server might take to long for the request.

      So first try to switch the framework. If that doesn’t work out either I will check your site if there is any other function that might cause problems with my plugin.

  8. Frank sagt:

    Hi Bernhard
    I like your plugin – works great. My question is – is it possible to make this search only one table in the DB? I have added a glossary of real estate terms and would like to search that and not the posts/categories/tags.
    thanks,
    Frank

    • Bernhard sagt:

      You can change the Query inside of the autocompleter-results.php (line 30-46). But as it is a search plugin for posts and pages it is not possible to do it without changing the plugin files.

      How would you like to select the table in which the plugin should search for? Manybe I’ll add that option to the plugin.

  9. Juan sagt:

    Excellent plugin but with script.aculo.us in IE8 the matching titles doesn’t show any background at all. Any idea? Thanks again for your contribution!
    Juan

    • Bernhard sagt:

      Thanks a lot for your comment. There seems to be a issue with IE8 and the Element() function of prototype. The class name was not added to the element and so the CSS had no effekt in IE8. I fixed that and added the class with the addClassName() function after creating the element. It should now also work in IE8. Just update the plugin to version 2.3 and it should work in IE8 with prototype.

      • Juan sagt:

        Hey Bernhard!! Thanks a lot for your quick reply. You worth a donation!! ;-)
        One more request, please remove my last comment, I entered my email address in the name box by mistake.
        Thanks a lot again!!!

        • Bernhard sagt:

          No problem. And as I have to accept every comment for new commenters (new name or email address) your comment was only visible for you but for nobody else. I’m glad I could have helped you. I am always happy to getting some feedback, even if they tell me about some bugs I haven’t found, yet. And many thanks for the donation. You are the second who donated to one of my plugins.

  10. reza sagt:

    hi

    how to add taxonomies in result search?

    thank you

    • Bernhard sagt:

      I am not quite sure what you want to do? Do you want to have a search for taxonomies or do you want to add the taxonomies to the list of results. That might be a little much of data. Or do you want only the title and the taxonomies as a result. I may include a option to display taxonomies in the results.

  11. Andrew sagt:

    Is there a way to set the search to accept multiple keywords.

    For example if the user types “cool post”

    Can this plugin search the database to find a post that has both the keywords “cool” and “post” at the same time.

    I was fooling around with it and used:

    explode(” “,$words);
    - to get the each word the user enters (separated by spaces)

    After that I’m a bit confused where to go.

    After that I’m stuck.

    • Bernhard sagt:

      What you can do is replace the line 28 in the file autocompleter_results.php with this line:

      $words = '%'.implode("%", explode(" ", $_REQUEST['q'])).'%';
      

      This will first split the searcg string on every space and then combines it again with a percentage sign, which is in the MySQL database used as a wildcard.

      If you have further questions just ask again.

Hinterlasse einen Kommentieren

Impressum