03
fév
FaceBook Like – jQuery and autosuggest Search Engine
![]() |
Je vous présente ici module permettant de mettre en place un moteur de recherche style "FaceBook" avec autocomplétion.
Ce module s’appuie sur les librairies de jQuery, ainsi que sur le module d’autocomplétion ‘Bsn Autosuggest".
Côté customisation, on peut s’appuyer sur des plugins de recherche qui permettent de catégoriser les résultats de recherche.
=> Exemple : http://web2ajax.fr/examples/facebook_searchengine/
Have Fun !

Very nice! Good work.
février 5th, 2008 at 4:58You rock fuckin’ hard baby
février 5th, 2008 at 5:51Good work man!
février 6th, 2008 at 8:22good work!
février 6th, 2008 at 11:06[...] Blackprof.com â
février 7th, 2008 at 7:20[...] FaceBook Like – jQuery and autosuggest Search Engine [...]
février 27th, 2008 at 9:08very good
mars 1st, 2008 at 2:21I love it, and will spend some time digest it
mars 7th, 2008 at 3:32Thanks !
mars 7th, 2008 at 11:48Greatful design for your website and good luck !
Dynamically add rows with Autosuggest enabled for textboxes using http://ramanbasu.com/tricks/DynamicRow/
avril 1st, 2008 at 7:34[...] FaceBook Like – jQuery and autosuggest Search Engine- This autosuggest search engine is inspired from facebook for design, use jQuery as ajax framework [...]
avril 9th, 2008 at 6:00[...] FaceBook Like – jQuery and autosuggest Search Engine- 一个类似于Facebook的搜索引擎,主要的特点就是搜索时的自动提示 使用 [...]
avril 10th, 2008 at 8:54[...] FaceBook Like – jQuery and autosuggest Search Engine, Masked Input Plugin, jQuery Enchant, EasyDrag jQuery Plugin, Simple Effects Plugins y Slide out [...]
avril 11th, 2008 at 12:53Thanks for the comments. You’ve got a pretty useful site here so keep it up!
avril 11th, 2008 at 5:22[...] FaceBook Like – jQuery and autosuggest Search Engine- This autosuggest see engine is inspired from facebook for design, ingest jQuery as ajax support [...]
mai 6th, 2008 at 10:03[...] FaceBook Like – jQuery and autosuggest Search Engine- This autosuggest see engine is inspired from facebook for design, ingest jQuery as ajax support [...]
mai 6th, 2008 at 10:03Great work!
juin 11th, 2008 at 5:35I have download the example but it didnt work. Can you upload another examplo with sql?
juillet 1st, 2008 at 2:23En fet je quoi avoir trouvé le probleme, je n’ai pas de json sur php4
juillet 24th, 2008 at 12:56[...] Autosuggest search engineSuggest form field values the Facebook way. [...]
août 19th, 2008 at 4:46Félicitations, très joli et efficace!!
J’aurais besoin d’une petite personnalisation de ce module…
Pouvez-vous me contacter pour en discuter?
Salut!
septembre 2nd, 2008 at 5:23Hi,
Thanks for this great plugin. However I’m having some troubles implementing it on my server.
I managed to get the results from my MySQL DB, however in the process I lost the division between the « country’s and capitals ».
The division is the grey box in the search results that nicely separates the different type of results.
Could you point me into the direction of which part of the code handles the seperation?
Thanx alot!
septembre 6th, 2008 at 10:19Geert
[...] FaceBook Like – jQuery and autosuggest Search Engine- This autosuggest search engine is inspired from facebook for [...]
septembre 12th, 2008 at 4:19[...] FaceBook Like – jQuery and autosuggest Search Engine- This autosuggest search engine is inspired from facebook for [...]
octobre 11th, 2008 at 8:48[...] Facebook like Autocomplete [...]
octobre 12th, 2008 at 9:01This a very Good Script for the webmasters thanks for this.
octobre 12th, 2008 at 12:27Deepak Oberoi
http;//www.expertzweb.com
how do i use this example with mysql?
octobre 20th, 2008 at 10:53Cand u help me?
Hi,
To use a mysql request to return results :
- do your request
- format the results in json like the page « http://web2ajax.fr/examples/facebook_searchengine/AjaxSearch/_doAjaxSearch.action.php?json=true&limit=8&input=je » I load in ajax
For example, I use this php class to encode an array in json : http://solarphp.com/class/Solar_Json
Hoping my answer will help you.
Bye
octobre 20th, 2008 at 1:54Is there anyway to « preload » the data without the user having to type anything first. So right when he starts typing, the data is available instantly?
octobre 22nd, 2008 at 3:16@Mike : Yes you can and you have two ways :
1/ You generate a js file with php and load it in your headers
2/ The other solution is calling a js file after the autocomplete loading with $.get and in the success trigger, you assign the result of the js to a var
In those two cases, look in the example that is exactly what I do.
Ciao.
octobre 22nd, 2008 at 9:09I’m not sure I follow. I’m trying to make the request to my php page only one time when the document loads. So I have no need for an « input » parameter either. I understand how to use the $.get and assign the resulting json to a variable, but how do I inject that into the list?
octobre 23rd, 2008 at 5:25c’est souvent très sympa dev visiter ton bllg
octobre 23rd, 2008 at 4:17Merci Nicolas, même si je n’ai pas trop eu le temps de poster en ce moment…
Mais je vais bientôt me rattraper, ne vous inquietez pas
octobre 23rd, 2008 at 11:49@Mike :
I’m sorry but for moment I don’t understand your needs
If you have no need for an input, did you really want an autocomplete plugin ?
Perhaps you need a combobox rather ?
But as i said, i’m not sure to imagine what you think about… So tell me more
octobre 23rd, 2008 at 11:58Dear friend
i try u r answer but, i cant do it.
can u upload any code anywahere?
I dont want use array, i want filter from just mysql
Please help me.
Sory form my bad eng.
Thank u so much.
Adil Kara Said:
how do i use this example with mysql?
Cand u help me?
octobre 20th, 2008 at 10:53 Guiltouf Said:
Hi,
To use a mysql request to return results :
- do your request
- format the results in json like the page “http://web2ajax.fr/examples/facebook_searchengine/AjaxSearch/_doAjaxSearch.action.php?json=true&limit=8&input=je” I load in ajax
For example, I use this php class to encode an array in json : http://solarphp.com/class/Solar_Json
Hoping my answer will help you.
By
octobre 26th, 2008 at 5:39[...] 16.2 FaceBook Like – jQuery and autosuggest Search Engine [...]
novembre 3rd, 2008 at 7:51[...] 16.2 FaceBook Like – jQuery and autosuggest Search Engine [...]
novembre 3rd, 2008 at 10:03You rox man !!!
novembre 3rd, 2008 at 10:39Superb plugin!
[...] FaceBook Like – jQuery and autosuggest Search Engine [...]
novembre 4th, 2008 at 10:16[...] FaceBook Like – jQuery and autosuggest Search Engine [...]
novembre 4th, 2008 at 11:03[...] FaceBook Like – jQuery and autosuggest Search Engine (tags: jquery autosuggest search autocomplete plugin) [...]
novembre 7th, 2008 at 7:02[...] 16.2 FaceBook Like – jQuery and autosuggest Search Engine [...]
novembre 11th, 2008 at 2:21FaceBook Like – jQuery and autosuggest Search Engine…
FaceBook Like – jQuery and autosuggest Search Engine…
novembre 15th, 2008 at 7:59[...] 16.2 FaceBook Like – jQuery and autosuggest Search Engine [...]
novembre 23rd, 2008 at 3:25[...] FaceBook Like – jQuery and autosuggest Search Engine- This autosuggest search engine is inspired from facebook for [...]
novembre 30th, 2008 at 11:46Hi,
I downloaded the code and uploaded it to my server. The page loads ok, but when I type into the input boxes I get the following javascript error:
———————–
Line: 154
Char: 2726
Error: Syntax error
Code: 0
URL:
———————–
Do you have any idea what might be causing the error?
Thanks
décembre 4th, 2008 at 9:28@Interested Developer :
I’ll just recommend you to use Firefox and his Firebug extension or the excellent Google Chrome to debug your dev.
IE does this so bad…
Once you installed Firebug, you’ll see that the error message have more interests
Ciao.
décembre 5th, 2008 at 11:09great plugin! I have tried a few different ones but this one is the best I could find.
I just have one issue and was wondering if you were planning to have something like this in your code.
Basically I want to display all values and not limit the search. And then just display the values in a scrollable div. I have made the css changes to have a fixed height for the div and just have a overflow: auto. But the issue I am facing is that when you scroll through the list with up/down keys it does not scroll the list. So there needs to be something in javascript that tracks the selected item and scrolls the div relatively.
décembre 12th, 2008 at 2:54i had the same problem. i used firebug and found the error to be « invalid flag after regular expression »
i’ve tried to solved it but in void, thinking that the problem must not lie in the codes itself. anyone help~
décembre 13th, 2008 at 9:02[...] FaceBook Like – jQuery and autosuggest Search Engine- This autosuggest search engine is inspired from facebook for design, use jQuery as ajax framework [...]
décembre 17th, 2008 at 6:12Dear friend
i try u r answer but, i cant do it.
can u upload any code anywahere?
I dont want use array, i want filter from just mysql
Please help me.
Sory form my bad eng.
Thank u so much.
Adil Kara Said:
how do i use this example with mysql?
Cand u help me?
octobre 20th, 2008 at 10:53 Guiltouf Said:
Hi,
To use a mysql request to return results :
- do your request
- format the results in json like the page “http://web2ajax.fr/examples/facebook_searchengine/AjaxSearch/_doAjaxSearch.action.php?json=true&limit=8&input=je” I load in ajax
For example, I use this php class to encode an array in json : http://solarphp.com/class/Solar_Json
Hoping my answer will help you.
By
décembre 18th, 2008 at 9:01[...] 16.2 FaceBook Like – jQuery and autosuggest Search Engine [...]
décembre 21st, 2008 at 7:21[...] 24) FaceBook Like – jQuery and autosuggest Search Engine- This autosuggest search engine is inspired from facebook for design, use jQuery as ajax framework and BSN Autosuggest libs. [...]
février 2nd, 2009 at 8:44Hi,
This is a great development !
Now I’m playing with the SQL query to query a Database I’m not able to parse anything when I have an array that should be usable.
Now you use the same, are you willing to share this information in some more detail with us ?
Thanks !
Matt
février 4th, 2009 at 12:42[...] to quickly search and select audio and video files in a database. You can download the code from web2ajax and read along to see how I implemented it into my project using a MySQL tables as the [...]
février 12th, 2009 at 9:36Hi,
Your MySQL development is very vague and unclear.
It does not work as far as I can see. And you should be able to use a simple query with mysql_fetch_array.
Just simplify, update and be more in detail on your blog, very unclear to lots of people.
Thanks
Matt
février 13th, 2009 at 6:23@matt :
1/ I’m totatlly sorry to not offer the prestation you don’t paid…
2/ I don’t see how my sql development could be vague and unclear, because there is no sql in the example files…
3/ Please sleep before posting a message, or stop drinking…
Guiltouf
février 15th, 2009 at 5:49Hi this looks like a really great plugin – just what I am after! Thanks for making this available.
I am new to jQuery and javascript in general, and there’s something I don’t understand…
Have you done anything special in the js code to make it categorize the results when using multiple plugins? Or is it just the server-side JSON/XML generation that is different to the standard BSN Autosuggest?
I cannot work it out from your code or your example download, sorry.
Thanks again,
Owen
mars 12th, 2009 at 3:58Good Work… Thanks!
mars 13th, 2009 at 4:41Salut, je cherchais depuis un bout de temps un moteur de recherche en ajax et là! C’est parfait… Un grand merçi à toi.
J’ai pu l’intégrer à mon site (en cours de développement) et une question me turlupine : Le script cherche les données (cities & country) sur les deux fichiers php mais je voudrai qu’il cherche via une base de données mySql…
Débutant en php j’ai essayer d’établir une connexion SQL via les deux fichiers « plugin.capitals.php » et « country » mais rien n’y fait! Je m’y prend comme un pied ^^
Pourrai-tu m’éclairer ça serait sympa
?
En tous cas j’ai pu visiter ton site, il est super! Bravo et bonne continuation.
Bonne journée,
mars 22nd, 2009 at 5:56@Owen : to categorize the results, I use a special « info » field called ‘plugin_header’ which is interpreted in JS as a category.
mars 23rd, 2009 at 5:46@Visual3D : pour simplifier un peu les choses, je vais prendre le fichier « plugin.capitals.php’ :
Ce fichier comme il est dans le .zip se comporte en fait comme une base de donnée, je m’explique : la variable $country_list est en fait la base de donnée complète.
Si tu regardes Ligne 17, celle qui est commentée, c’est la requête sql que je fais en temps normal , requete que j’ai remplacé pour l’exemple par le tableau $country_list.
Donc en gros, tu fais ta requete sql qui cherche dans ta table mysql, tu fais une boucle sur les résultats et en gros, avec la classe mysql que j’utilise, ça donnerait ça :
#@ Detect if loaded by search_engine
if ( ! SEARCHENGINE_LOADED ) return false;
#@ Category Name
$searchCat_name = 'Cities' ;
#@ Do search
$sql = 'SELECT * FROM capitals LIKE "%'.$search_engine['options']['input'].'%"
ORDER BY capital
LIMIT 0, '.$search_engine['options']['search_limit'] ;
$db->query($sql) ;
while ( $val = $db->next_record() ) {
$results['value'] = utf8_encode($val['capital']). ' ('.utf8_encode($val['code']).')';
$results['info'] = utf8_encode($val['common_name']) ;
$search_engine['results'][$searchCat_name][$val[id]] = $results ;
}
Est-ce que tu comprends mieux comment utiliser un plugin maintenant ?
mars 23rd, 2009 at 6:02Re! Merçi pour ses explications…
Alors j’ai suivi tes indications mais je n’arrive toujours à faire fonctionner le moteur : et c’est normal puisque je n’arrive pas à établir ma connexion avec ma base de données Sql je pense.
Je m’y suis pris comme cela :
———————————————————————–
Fichier »configuration.php » :
——————————————
Ma base de donnée : toto
Table : table_toto
Champs:
ID
TITRE
DESCRIPTION
ARTICLES
—————————————————-
Et voilà pour le plugin.capitals.php
// Mon fichier de connexion.php relatif à ma base SQL
query($sql) ;
while ( $val = $db->next_record() ) {
$results['value'] = utf8_encode($val['TITRE']). ‘ (’.utf8_encode($val['ARTICLES']).’);
$results['info'] = utf8_encode($val['DESCRIPTION']) ;
$search_engine['results'][$searchCat_name][$val[ID]] = $results ;
}
// J’ai remplacer les champs « Capital,code, et id par les champs de ma table
?>
…Aucune connexion en vue : c’est sur il y a des erreurs au niveau de ma connexion SQL!
Désolé si je t’embête avec ce script. Je l’avoue je commence en php, j’y arrive quelque fois mais ça reste de la bidouille ^^
Merçi pour ton aide. @++
mars 23rd, 2009 at 7:37Re! Merçi pour ses explications…
Re, oups dsl j’ai oublié d’enlever les « php » , tout ne s’est pas affiché!
———————————————————————–
Fichier »configuration.php » :
// Paramètres de connexion
$hostname_toto = « localhost »; // nom serveur
$database_toto = « toto »; // nom base de données
$username_toto = « root »; // nom utilisateur
$password_toto = « »; // mot de passe
$sql = mysql_connect($hostname_toto, $username_toto, $password_toto) or trigger_error(mysql_error(),E_USER_ERROR);
——————————————
Ma base de donnée : toto
Table : table_toto
Champs:
ID
TITRE
DESCRIPTION
ARTICLES
—————————————————-
Et voilà pour le plugin.capitals.php
require_once(‘connexion.php’); // Mon fichier de connexion.php relatif à ma base SQL
#@ Detect if loaded by search_engine
if ( ! SEARCHENGINE_LOADED ) return false;
#@ Category Name
$searchCat_name = ‘Cities’ ; //Je dois laisser Cities ?
#@ Do search
mysql_select_db($database_toto, $sql); // j’ai rajouté cette ligne pour établir la connexion est-ce que c’est ok ?
$sql = ‘SELECT * FROM table_toto LIKE « %’.$search_engine['options']['input'].’%”
ORDER BY TITRE LIMIT 0, ‘.$search_engine['options']['search_limit'] ;
$db->query($sql) ;
while ( $val = $db->next_record() ) {
$results['value'] = utf8_encode($val['TITRE']). ‘ (’.utf8_encode($val['ARTICLES']).’);
$results['info'] = utf8_encode($val['DESCRIPTION']) ;
$search_engine['results'][$searchCat_name][$val[ID]] = $results ;
}
// J’ai remplacer les champs « Capital,code, et id par les champs de ma table
mars 23rd, 2009 at 7:40Tiens, je te conseille d’utiliser une classe pour se connecter à mysql, c’est ce que j’utilise dans tous mes projets et c’est beaucoup moins lourd à utilise après.
Donc tu mets tout ça dans un fichier nommé ‘class.db.php’ :
< ?phpclass DB {
var $Host = SQL_HOST; // Hostname of our MySQL server
var $Database = SQL_BDD; // Logical database name on that server
var $User = SQL_USER; // Database user
var $Password = SQL_PASSWORD;// Database user's password
var $Link_ID = 0; // Result of mysql_connect()
var $Query_ID = 0; // Result of most recent mysql_query()
var $Record = array(); // Current mysql_fetch_array()-result
var $Row; // Current row number
var $Errno = 0; // Error state of query
var $Error = "";
#
# Create a link id to the MySQL database
# Allow to call $var = new DB($otherhost,$otherDB,$otheruser,$otherpass);
# where $other* are connections vars different from
# $this->Host, etc
#
function DB($altHost = "",$altDB = "",$altUser = "",$altPassword = "") {
if ($altHost == "")
$altHost = $this->Host;
if ($altDB == "")
$altDB = $this->Database;
if ($altUser == "")
$altUser = $this->User;
if ($altPassword == "")
$altPassword = $this->Password;
$this->Host = $altHost;
$this->Database = $altDB;
$this->User = $altUser;
$this->Password = $altPassword;
}
#@ Class destructor
function __destruct() {
$this->close() ;
foreach ($this as $index => $value) unset($this->$index);
}
#
# Stop the execution of the script
# in case of error
# $msg : the message that'll be printed
#
function halt($msg, $halt_after = false) {
echo("
Database error: $msg
\n");
if ( $halt_after ) {
die("
@=> Page loading aborted... ");
} else {
echo("MySQL error: ") ;
echo("
$this->Errno ($this->Error)
") ;
}
}
#
# Connect to the MySQL server
#
function connect() {
global $DBType;
if($this->Link_ID == 0) {
$this->Link_ID = @mysqli_connect($this->Host,
$this->User,
$this->Password);
if (!$this->Link_ID) {
$this->halt("Connect to [$this->Host] failed.
Please verify Host, Login and Password.", $halt_after = true);
}
$SelectResult = @mysqli_select_db($this->Link_ID, $this->Database);
// Set default to UTF8
$this->query('SET NAMES UTF8;') ;
if(!$SelectResult) {
$this->Errno = mysqli_errno($this->Link_ID);
$this->Error = mysqli_error($this->Link_ID);
$this->halt("cannot select database ".$this->Database."", $halt_after = true);
return false ;
}
}
#@ Else return true
return true ;
}
#
# Send a query to the MySQL server
# $Query_String = the query
#
function query($Query_String) {
// DEBUG MODE
$this->debug = false ;
// DEBUG : Store microtime to log requests
( $this->debug ? $time_start = microtime(true) : false ) ;
$this->connect();
//_dumpLog($Query_String) ;
$this->Query_ID = @mysqli_query($this->Link_ID, $Query_String);
$this->Row = 0;
$this->Errno = mysqli_errno($this->Link_ID);
$this->Error = mysqli_error($this->Link_ID);
if ( $this->Errno == 2006 ) {
unset($this->Link_ID) ;
$this->connect();
$this->Query_ID = @mysqli_query($this->Link_ID, $Query_String);
$this->Row = 0;
$this->Errno = mysqli_errno($this->Link_ID);
$this->Error = mysqli_error($this->Link_ID);
if (!$this->Query_ID) {
$this->halt("Invalid SQL: ".$Query_String);
}
} else {
if (!$this->Query_ID) {
$this->halt("Invalid SQL: ".$Query_String);
}
}
// DEBUG : Store microtime to log requests
( $this->debug ? $time_stop = microtime(true) : false ) ;
// DEBUG WRITE A LOG
if ( $this->debug ) {
_dumpLog("sql : $Query_String | exec : " . ( $time_stop - $time_start) . "ms", $error_level=1) ;
}
return $this->Query_ID;
}
#
# return the next record of a MySQL query
# in an array
#
function next_record() {
$this->Record = @mysqli_fetch_array($this->Query_ID, MYSQLI_ASSOC);
$this->Row += 1;
$this->Errno = mysqli_errno($this->Link_ID);
$this->Error = mysqli_error($this->Link_ID);
$stat = is_array($this->Record);
if (!$stat) {
@mysqli_free_result($this->Query_ID);
$this->Query_ID = 0;
}
return $this->Record;
}
#
# return the next record of a MySQL query
# in an object
#
function fetch_assoc() {
$this->Record = @mysqli_fetch_assoc($this->Query_ID, MYSQLI_ASSOC);
$this->Row += 1;
$this->Errno = mysqli_errno($this->Link_ID);
$this->Error = mysqli_error($this->Link_ID);
$stat = is_object($this->Record);
if (!$stat) {
@mysqli_free_result($this->Query_ID);
$this->Query_ID = 0;
}
return $this->Record;
}
#
# Return the number of rows affected by a query
# (except insert and delete query)
#
function num_rows() {
return @mysqli_num_rows($this->Query_ID);
}
#
# Return the number of affected rows
# by a UPDATE, INSERT or DELETE query
#
function affected_rows() {
return @mysqli_affected_rows($this->Link_ID);
}
#
# Return the id of the last inserted element
#
function insert_id() {
return mysqli_insert_id($this->Link_ID);
}
#
# Seeking position
#
function data_seek($offset) {
return mysqli_data_seek($this->Link_ID, $offset);
}
#
# Retourne le resultat d'une requete qui ne veut avoir qu'un seul champ par ligne
#
function get_one_data($SQL, $field) {
$this->query($SQL) ;
$valSQL = $this->next_record() ;
return $valSQL[$field] ;
}
#
# Retourne la liste des tables d'une base
#
function list_tables($base) {
$result = $this->query(empty($base) ? 'SHOW TABLES' : "SHOW TABLES FROM `$base`");
$tables = array();
while (list($name) = $result->fetch_row()) {
$id = preg_replace("#^($prefix|$user_prefix)_#", '', $name);
$tables[$id] = $name;
}
$result->free();
return $tables ;
}
#
# Optimize a table
# $tbl_name : the name of the table
#
function optimize($tbl_name) {
$this->connect();
$this->Query_ID = mysqli_query("OPTIMIZE TABLE $tbl_name",$this->Link_ID);
}
#
# Free the memory used by a result
#
function clean_results() {
if($this->Query_ID != 0) {
mysqli_free_result($this->Query_ID);
}
}
#
# Close the link to the MySQL database
#
function close() {
if($this->Link_ID != 0) mysqli_close($this->Link_ID);
}
#
# Return list of table's fields
#
function get_field_list($tbl_name) {
$list_fields = mysqli_query("SHOW FIELDS FROM $tbl_name", $this->Link_ID);
while ($field_name = mysqli_fetch_array($list_fields)) {
$field_list[] = $field_name[0] ;
}
return $field_list ;
}
#
# Fetch all results and return an array with all results
#
function fetch_allResults($sql, $no_id = false, $field = false) {
$this->query($sql) ;
unset($return_array) ;
$i = 0 ;
if ( $this->num_rows() ) {
while ($val = $this->next_record() ) {
$return_array[$i++] = $val ;
}
@mysqli_free_result($this->Query_ID);
} else {
return false;
}
// If waiting for only one line in return, use this param
if ( $no_id ) {
if ( $field ) {
return $return_array[0][$field] ;
} else {
return $return_array[0] ;
}
} else {
return $return_array ;
}
}
}
?>
Et après, tu mets un fichier de conf que tu appelles avant la classe avec tes paramètres de connexion dedans :
DEFINE ("SQL_HOST", "127.0.0.1");DEFINE ("SQL_BDD", "le_nom_de_ta_base_dev");
DEFINE ("SQL_USER", "ton_user_mysql");
DEFINE ("SQL_PASSWORD", "ton_password");
Tu vas voir, c’est du bonheur en boite après
mars 23rd, 2009 at 9:26Slt, merçi encore une fois de prendre le temps de me répondre
Alors j’ai essayer d’appliquer cette classe, mais le problème c’est que j’ai déja des requêtes sql de faite avec un script de connexion php et divers éléments : il faudrait que je reprenne tout le code pour intégrer correctement cette classe!
D’autant plus que je suis vraiment débutant en php : c’est pas évident ^^ Mais c’est sur cela doit être beaucoup plus propre.
J’ai quand même essayer de cette manière qui n’est surement pas la bonne ^^
————————————————————–
Fichier « plugin.capital.php »
//Ou include?
query($sql) ;
while ( $val = $db->next_record() ) {
$results['value'] = utf8_encode($val['TITRE']). ‘ (’.utf8_encode($val['ARTICLES']).’);
$results['info'] = utf8_encode($val['DESCRIPTION']) ;
$search_engine['results'][$searchCat_name][$val[ID]] = $results ;
}
? >
————————————–
Fichier conf.php
———————————————
Fichier db.class.php
Comme tu me l’a indiqué.
Je ne sais plus trop ce que je dois faire et je voudrai pas abusé de ton temps, je vais ressayer quand même histoire de me faire la main. Merçi
mars 24th, 2009 at 12:01Haa mince encore les « php » dsl !
————————————————————–
Fichier « plugin.capital.php »
require_once(‘conf.php’);
//Ou include?
require_once(‘class.db.php’);
#@ Detect if loaded by search_engine
if ( ! SEARCHENGINE_LOADED ) return false;
#@ Category Name
$searchCat_name = ‘Cities’ ;
#@ Do search
$sql = ‘SELECT * FROM toto LIKE « %’.$search_engine['options']['input'].’%”
ORDER BY TITRE LIMIT 0, ‘.$search_engine['options']['search_limit'] ;
$db->query($sql) ;
while ( $val = $db->next_record() ) {
$results['value'] = utf8_encode($val['TITRE']). ‘ (’.utf8_encode($val['ARTICLES']).’);
$results['info'] = utf8_encode($val['DESCRIPTION']) ;
$search_engine['results'][$searchCat_name][$val[ID]] = $results ;
}
————————————–
Fichier conf.php
DEFINE (« SQL_HOST », « localhost »);
DEFINE (« SQL_BDD », « toto »);
DEFINE (« SQL_USER », « root »);
DEFINE (« SQL_PASSWORD », « »);
———————————————
Fichier db.class.php
Comme tu me l’a indiqué.
mars 24th, 2009 at 12:03Very cool, it does realy helped me in my work!
avril 14th, 2009 at 7:30Bonjour,
j’ai telechargé « autosuggest Search Engine » et je n’arrive même pas à le faire marcher comme tel ( sans rien modifier ), je pensais que c’était la version de mon easyphp qui était en cause mais même avec easyphp 3 c’est pareil .
Y’a t-il quelque chose qui m’aurait échappé, j’ai regardé les chemin des pages, j’ai regardé Json sur php info et il est enabled . Si vous avez des pistes je vous en serez reconnaissant .
Morgane.
mai 20th, 2009 at 5:13Bonjour Morgane,
Pour regarder un petit peu ce qui se passe dans la matrice, est-ce que tu as l’extension firebug pour mozilla ?
Cela va te servir à voir quelles requetes sont envoyées quand tu tapes un caractères dans le champ input et surtout de voir la réponse qui t’es renvoyée.
Normalement, la réponse doit être au format json. Si ce n’est pas le cas, tu devrais voir des erreurs.
N’hésite pas à reposter si tu as toujours des soucis.
Bon courage.
mai 28th, 2009 at 12:50merci, je vais regarder de ce coté la
mai 29th, 2009 at 10:14hi.
juin 2nd, 2009 at 12:17I have a problem with the facebook search engine, i adapted it to my mysql db and in my pc (with apache and all the stuff) works fine, but when i update it to the server it doesn’t work more…
Do you know what can cause the problem?
The initial message on the text field appears but nothing happens when i wirte some text.
the strange it’s that it works on my ocal server but not on the website server..
Can you help me?
Thanks
hm.. funny ))
juin 20th, 2009 at 3:04[...] 13.) FaceBook Like – jQuery and autosuggest Search Engine [...]
juillet 6th, 2009 at 7:47[...] 13.) FaceBook Like – jQuery and autosuggest Search Engine [...]
juillet 6th, 2009 at 8:42[...] 13.) FaceBook Like – jQuery and autosuggest Search Engine [...]
juillet 7th, 2009 at 1:54[...] 13.) FaceBook Like – jQuery and autosuggest Search Engine [...]
juillet 7th, 2009 at 8:56[...] 13.) FaceBook Like – jQuery and autosuggest Search Engine [...]
juillet 12th, 2009 at 12:56[...] 13.) FaceBook Like – jQuery and autosuggest Search Engine [...]
juillet 22nd, 2009 at 3:28Hi Guiltouf,
I have tried downloading your: FaceBoox style autosuggest with jQuery on the webpage: http://www.web2ajax.fr/examples/facebook_searchengine/
I cant get the example to work on my local. It comes up with an error
Message: Syntax error
Line: 154
Char: 2726
Code: 0
URI: http://localhost/facebook_searchengine/
I have read all the comments in here, and tried with firefox without any solution of the bugged download you have published hm:/ Can you please help me?
Regards,
août 7th, 2009 at 12:23Allan
[...] 13.) FaceBook Like – jQuery and autosuggest Search Engine [...]
août 14th, 2009 at 11:55[...] 13.) FaceBook Like – jQuery and autosuggest Search Engine [...]
août 15th, 2009 at 6:23[...] web2ajaxFaceBook Like – jQuery and autosuggest Search Engine [...]
août 24th, 2009 at 10:54[...] web2ajaxFaceBook Like – jQuery and autosuggest Search Engine [...]
août 25th, 2009 at 12:06[...] web2ajax FaceBook Like – jQuery and autosuggest Search Engine [...]
août 25th, 2009 at 2:53[...] web2ajax FaceBook Like – jQuery and autosuggest Search Engine [...]
août 26th, 2009 at 5:16[...] web2ajax FaceBook Like – jQuery and autosuggest Search Engine [...]
août 26th, 2009 at 10:09[...] FaceBook Like – jQuery and autosuggest Search Engine (demonstração online) Plugin para criar um autosuggest com um design baseado no do Facebook. [...]
août 27th, 2009 at 7:02[...] web2ajax FaceBook Like – jQuery and autosuggest Search Engine [...]
août 28th, 2009 at 8:36[...] web2ajaxFaceBook Like — jQuery and autosuggest Search Engine [...]
août 28th, 2009 at 5:09[...] web2ajax FaceBook Like – jQuery and autosuggest Search Engine [...]
août 29th, 2009 at 3:41[...] web2ajaxFaceBook Like – jQuery and autosuggest Search Engine [...]
septembre 4th, 2009 at 10:47[...] web2ajax FaceBook Like – jQuery and autosuggest Search Engine [...]
septembre 6th, 2009 at 11:35[...] web2ajaxFaceBook Like – jQuery and autosuggest Search Engine [...]
septembre 9th, 2009 at 6:11Hi! I was surfing and found your blog post… nice! I love your blog.
Cheers! Sandra. R.
septembre 11th, 2009 at 12:06[...] FaceBook Like – jQuery and autosuggest Search Engine (demonstração online) Plugin para criar um autosuggest com um design baseado no do Facebook. [...]
septembre 17th, 2009 at 11:55[...] web2ajaxFaceBook Like – jQuery and autosuggest Search Engine [...]
septembre 24th, 2009 at 7:28[...] Facebook like Autocomplete [...]
octobre 3rd, 2009 at 6:48After downloading the code and running in local server i am getting this error Notice: Undefined index: plugin….action.php on line 20\n I got this error in firebug. Also i have noticed this the common error reported by few of the members. You have devloped a great plugin but it will be better if you will fix the common errors it would be a great help.
octobre 16th, 2009 at 10:46Hi Chitta,
First, I think you have to disable E_NOTICE errors in your php.ini configuration.
I use something like this in my configuration :
error_reporting = E_ALL & ~E_NOTICE
It’s normal if you use all-in-one WAMP like EasyPhp.
Try this and if you have always the problem, can you log me the full error ( full path of file ).
Have fun !
octobre 18th, 2009 at 2:51[...] FaceBook Like – jQuery and autosuggest Search Engine- This autosuggest search engine is inspired from facebook for design, [...]
octobre 21st, 2009 at 3:20[...] [...]
octobre 22nd, 2009 at 8:40[...] jQuery And Autosuggest Search Engine FaceBook Like – jQuery and autosuggest Search Engine. Features autosuggest and ajax support, [...]
octobre 26th, 2009 at 5:13[...] 13.) FaceBook Like – jQuery and autosuggest Search Engine [...]
octobre 28th, 2009 at 9:49Dear Friend,
I’m not getting to donwload of file.
I’m redirecting to another page without nothing.
Where is file to download?
Thanks,
Jackson A. Diniz (BH/MG/Brazil)
novembre 6th, 2009 at 6:46jacksonanalista@gmail.com
Hi,
The download works for me, can you retry from the article’s link ?
Bye.
novembre 8th, 2009 at 5:44[...] 16.2 FaceBook Like – jQuery and autosuggest Search Engine [...]
novembre 17th, 2009 at 6:14[...] web2ajax FaceBook Like – jQuery and autosuggest Search Engine [...]
novembre 26th, 2009 at 11:29Salut !
Merci pour ce magnifique plugin mais j’aurai besoin d’un peu d’aide pour le faire marcher avec mysql.
j’utilise :
–
#@ Detect if loaded by search_engine
if ( ! SEARCHENGINE_LOADED ) return false;
#@ Category Name
$searchCat_name = ‘Teams’ ;
#@ Do search
$sql = ‘SELECT * FROM teams LIKE « %’.$search_engine['options']['input'].’% »
ORDER BY name
LIMIT 0, ‘.$search_engine['options']['search_limit']. »;
$db = mysql_query($sql);
#@ Transform txt in array
while ( $val = mysql_fetch_array($db) ) {
$results['value'] = utf8_encode($val['name']). ‘ (’.utf8_encode($val['initial']).’);
$results['info'] = utf8_encode($val['type']) ;
$search_engine['results'][$searchCat_name][$val['id']] = $results ;
}
–
Mais firebug me met :
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in F:\wamp\www\AjaxSearch\plugin.teams.php on line 27
{« results »: []}
Comment je pourrai le résoudre ? :/
Merci d’avance pour l’aide ^^
décembre 8th, 2009 at 10:30[...] web2ajax FaceBook Like – jQuery and autosuggest Search Engine [...]
décembre 13th, 2009 at 9:48[...] Download this Facebook-inspired auto-suggest search feature here. [...]
décembre 15th, 2009 at 5:49[...] Download this Facebook-inspired auto-suggest search feature here. [...]
décembre 19th, 2009 at 10:02[...] Descargue aquí esta característica de búsqueda por sugerencias automáticas inspirada en Facebook. [...]
décembre 21st, 2009 at 2:43[...] FaceBook Like – jQuery and autosuggest Search Engine- This autosuggest search engine is inspired from facebook for design, use jQuery as ajax framework [...]
janvier 10th, 2010 at 8:29[...] 2. Auto-Suggest with Jquery [...]
janvier 19th, 2010 at 2:24This is a great script. I have it working perfectly with a database. It works seamless. Thanks for your work on this!
I have one question: How can I take the desired result and use it else where. IE: I want to take a result and add it to a list, then do another search and add that result to the list as well, and so on. then when I’m done add the whole list to another database.
mars 12th, 2010 at 2:47Hi ! Great script you have here.
But i can’t figured out how to connect it to a database… I’m cgoing crazy…
Can someone help me ?
mars 12th, 2010 at 2:58Thanks
I can try. email me at bokhannes at gmail.com
mars 12th, 2010 at 3:21@Kitefr : it’s ok for the db connexion ?
@Rob E : the little tip I see is that you bind the input keyup() and at this moment, access to the list dom to know results.
mars 12th, 2010 at 7:39It’s not very beautiful but it works
@Guillaume : Still not ok. iI will send an email to Rob to know how he makes it works.
It works for me when i don’t use database connection but when i try to use it, i got no result :/
mars 12th, 2010 at 8:55@Guillaume : Thanks!
I totally forgot the info I wanted was in the input field. So I added a submit button and was able to work with the data I needed.
mars 12th, 2010 at 9:53@Kitefr : I recommand you to use to a php mysql class you can find on phpclasses.org or another website and which turn it easier to use and request db datas.
I’ve not the time today, but I will create a post with the class I use and how I use it. You’ll see as simple it is.
Bye
mars 13th, 2010 at 3:36@Guillaume : Thanks !
i’ll try to use a mysql class.
My web site is a total mess and i planned to do the version 3 in oriented-object to learn it.
Thanks again ^^
mars 13th, 2010 at 3:58Well, i tried but stil not working…
I hope you can help me Rob or Guillaume… :/
mars 14th, 2010 at 11:03@Kirefr Sent you an email let me know if you got it or not.
mars 15th, 2010 at 8:20Hi Rob !
I didn’t received your email :/
this is my adress just in case : kitefr at gmail.com
mars 15th, 2010 at 9:16