Placed in: Home arrow Programming arrow Webdesign arrow A fancy Apple.com-style search suggestion
A fancy Apple.com-style search suggestion

Apple is known to create beautiful products (next to the needed functionality of course). I already wrote several articles on how you can transfer some amazing iPhone designs to your webbrowser, I own a MacBook Pro (which also looks pretty sleek) and many other products from Apple are well known for their amazing design.

The website from Apple isn't less: The layout is simple yet beautiful. Yet, one of the most awesome things about the website is the search functionality. It gives you suggestions (with images) about the several products they offer, making it really user-friendly.

Today, we're trying to recreate the effect from that website by creating a fancy apple.com-style search suggestion. Make sure you check out the demo (or visit Apple.com) to see this awesome effect work.

A fancy Apple.com-style search suggestion

This example makes use of several techniques: MySQL (for the database), HTML/CSS for styling, PHP for retrieving the data and jQuery for the AJAX request. How about that for some nice way of combining powerful techniques to create something nice like this. You do need some basic knowledge about these techniques to fully understand this tutorial.

Demo Apple.com-style search suggestion   Download Apple.com-style search suggestion

IMPORTANT NOTE:
As you can see, the demo is located on another server. The reason for this is, that every time a user presses on his keyboard, a call is made to the MySQL database. When loads of users do loads of calls (at the same time), this could result in slowing down the database. The answer for this would that the results should be cached - Something that isn't implemented right now.

Safari, Chrome and Opera are currently the only webbrowsers that support the drop shadow effect around the the search results. Other browsers will simply display the results without the drop shadow.

This technique would be great if it were converted to a plugin for a CMS (WordPress/Joomla/Drupal etc.), but also just very cool to have on your website.

Safari Demo

Check out this small video I placed on YouTube, showing this effect in full glory.

Want to learn how I created it? Check it out.

MySQL

We'll need two tables in MySQL to do the job. I created a search table (containing most of the data) and a categories table (referenced by the search items). Visually, they look like this:

MySQL Categories

MySQL Search

The SQL dump looks like this:

 
CREATE TABLE IF NOT EXISTS `categories` (
  `cid` int(11) NOT NULL AUTO_INCREMENT,
  `cat_name` varchar(255) NOT NULL,
  `cat_url` text NOT NULL,
  PRIMARY KEY (`cid`)
);
 
CREATE TABLE IF NOT EXISTS `search` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cat_id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `img` varchar(255) NOT NULL,
  `desc` text NOT NULL,
  `url` text NOT NULL,
  PRIMARY KEY (`id`)
);

I assume the names of the columns are pretty straight forward. You'll need to fill in the data yourself (in the download, you can find all the INSERTS that can be found in the demo). Also, take note of the AUTO_INCREMENT from both id's.

Now that we have the data stored, we'll need a front-end to place the data in. On to the next part!

HTML

Page

The HTML from the page isn't the spectecular: It simply holds one form element with an input box. Take note that no action is defined to the form. If you actually want to pass the data to the search page, you should add it. Also, no input-submit was added.

 
<div>
   <form id="searchform">
      <div>
         What are you looking for? <input type="text" size="30" value="" />
      </div>
      <div id="suggestions"></div>
   </form>
</div>

More interesting in the code above, is the (empty) divider with an id suggestions. We'll fill up this divider later on with jQuery to place the actual found search results in.

Search results

Even more interesting is the searchresults that we're going to display. Here's the HTML, I'll explain it below.

 
<p id="searchresults">
   <span class="category">[CATEGORY_FROM_DATABASE]</span>
      <a href="[URL_FROM_DATABASE]">
         <img alt="" src="search_images/[IMG_FROM_DATABASE]"/>
         <span class="searchheading">[HEADING_FROM_DATABASE]</span>
         <span>[TEXT_FROM_DATABASE]</span>
      </a>
      <a href="[URL_FROM_DATABASE]">
         <img alt="" src="search_images/[IMG_FROM_DATABASE]"/>
         <span class="searchheading">[HEADING_FROM_DATABASE]</span>
         <span>[TEXT_FROM_DATABASE]</span>
      </a>
      <!-- more items -->
   <span class="category">Webdesign</span>
      <a href="[URL_FROM_DATABASE]">
         <img alt="" src="search_images/[IMG_FROM_DATABASE]"/>
         <span class="searchheading">[HEADING_FROM_DATABASE]</span>
         <span>[TEXT_FROM_DATABASE]</span>
      </a>
   <!-- more categories -->
   <span class="seperator">
      <a href="http://www.marcofolio.net/sitemap.html">Nothing interesting here? Try the sitemap.</a>
   </span>
</p>
  • #searchresults - Main container to place the search results in.
  • .category - When a new category is displayed, simply use this span to differ it from the actual links.
  • .seperator - This is used at the bottom of the suggestion, linking to another page (in this case: the sitemap).
  • As you can expect, all values between the [] and written in capitals needs to be data from the database.

On to some CSS styling and make it look a lot more pretty!

CSS

Page

First, we'll fancy-up the page (looks pretty boring now, right?). I used the same background as in the polaroid viewer (hey, it looks pretty nice) and wrote the following CSS.

 
/* HTML ELEMENTS */
body { font-family:"Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif;
   background-color:#efefef; background-image:url(../images/bg.jpg); }
 
/* SEARCH FORM */
#searchform { margin:50px 200px; font-size:18px; }
#searchform div { color:#eeeeee; }
#searchform div input { font-size:18px; padding:5px; width:320px; }
#suggestions{ position: relative; left:235px; width:320px; display:none; }

Nothing really fancy going on over here, except for the #suggestions. As you can see, the display is set to none. Like I said, we'll fill that container using jQuery but we'll also show it (fade it in) using the javascript framework. We'll get to that later.

Our page should now look like this:

Web Page

Search results

The search results use a little bit more complex CSS. This is what I came up with.

 
/* SEARCHRESULTS */
#searchresults { border-width:1px; border-color:#919191; border-style:solid; width:320px; background-color:#a0a0a0; font-size:10px; line-height:14px; }
#searchresults a { display:block; background-color:#e4e4e4; clear:left; height:56px; text-decoration:none; }
#searchresults a:hover { background-color:#b7b7b7; color:#ffffff; }
#searchresults a img { float:left; padding:5px 10px; }
#searchresults a span.searchheading { display:block; font-weight:bold; padding-top:5px; color:#191919; }
#searchresults a:hover span.searchheading { color:#ffffff; }
#searchresults a span { color:#555555; }
#searchresults a:hover span { color:#f1f1f1; }
#searchresults span.category { font-size:11px; margin:5px; display:block; color:#ffffff; }
#searchresults span.seperator { float:right; padding-right:15px; margin-right:5px;
      background-image:url(../images/shortcuts_arrow.gif); background-repeat:no-repeat; background-position:right; }
#searchresults span.seperator a { background-color:transparent; display:block; margin:5px; height:auto; color:#ffffff; }

Nothing really fancy going on over here actually. Only the #searchresults a is displayed as an block element, making the click-area have a full width and height. The search results page (when filled with data) should now look like this.

Search Results

Awesome, looks pretty good already! Now for the fun stuff: The PHP.

PHP

You'll need to understand that the actual page is a static HTML file. The search results is a dynamic page generated by PHP based on the data retrieved.

This is the final PHP file that retrieves the data from the database and generates the needed HTML. I've added some comments to make the code more clear.

 
<p id="searchresults">
<?php
   // PHP5 Implementation - uses MySQLi.
   // mysqli('localhost', 'yourUsername', 'yourPassword', 'yourDatabase');
   $db = new mysqli('localhost', 'yourUsername', 'yourPassword', 'yourDatabase');
   
   if(!$db) {
      // Show error if we cannot connect.
      echo 'ERROR: Could not connect to the database.';
   } else {
      // Is there a posted query string?
      if(isset($_POST['queryString'])) {
         $queryString = $db->real_escape_string($_POST['queryString']);
         
         // Is the string length greater than 0?
         if(strlen($queryString) >0) {
            $query = $db->query("SELECT * FROM search s INNER JOIN categories c ON s.cat_id = c.cid WHERE name LIKE '%" . $queryString . "%' ORDER BY cat_id LIMIT 8");
            
            if($query) {
               // While there are results loop through them - fetching an Object.
               
               // Store the category id
               $catid = 0;
               while ($result = $query ->fetch_object()) {
                  if($result->cat_id != $catid) { // check if the category changed
                     echo '<span class="category">'.$result->cat_name.'</span>';
                     $catid = $result->cat_id;
                  }
                     echo '<a href="'.$result->url.'">';
                     echo '<img src="search_images/'.$result->img.'" alt="" />';
                     
                     $name = $result->name;
                     if(strlen($name) > 35) { 
                        $name = substr($name, 0, 35) . "...";
                     }                     
                     echo '<span class="searchheading">'.$name.'</span>';
                     
                     $description = $result->desc;
                     if(strlen($description) > 80) { 
                        $description = substr($description, 0, 80) . "...";
                     }
                     
                     echo '<span>'.$description.'</span></a>';
                  }
                  echo '<span class="seperator"><a href="http://www.marcofolio.net/sitemap.html" title="Sitemap">Nothing interesting here? Try the sitemap.</a></span><br class="break" />';
            } else {
               echo 'ERROR: There was a problem with the query.';
            }
         } else {
            // Dont do anything.
         } // There is a queryString.
      } else {
         echo 'There should be no direct access to this script!';
      }
   }
?>
</p>

Some final explanation:

  • isset($_POST['queryString']) - When the PHP file received a POST request with a value queryString, it'll work (otherwise, it doesn't). We'll do the POST request with jQuery.
  • mysqli - This script makes use of the PHP5 implementation of MySQLi. It created an object from the database (really handy). You'll need to change the values in the PHP file to make it connect to your database.
  • $db->query - This is the place where the query is executed. As you can see, I join on the categories table to retrieve the correct category name. You can also see, that the $queryString only looks (and searches) by the name. You could enhance this query to also look in the description etc.
  • strlen($name) > 35 - At this point, the script checks if the name is larger than 35 characters. If it is, it trims it down to 35 characters + "..." to make it fit.

jQuery

First things first: We'll need to change the original HTML to let the browser react to the "keydown" when the user is typing in the input field. To do so, add the following to the input:

 
onkeyup="lookup(this.value);"

Now, we'll need to actually define the lookup function within jQuery. Once again, I've added comments to make the code clear.

 
function lookup(inputString) {
   if(inputString.length == 0) {
      $('#suggestions').fadeOut(); // Hide the suggestions box
   } else {
      $.post("rpc.php", {queryString: ""+inputString+""}, function(data) { // Do an AJAX call
         $('#suggestions').fadeIn(); // Show the suggestions box
         $('#suggestions').html(data); // Fill the suggestions box
      });
   }
}

As you can see, when the inputString is empty, the suggestions box is being fadeOut. If not, it does an AJAX call to the PHP file (rpc.php) giving the inputString ad queryString. That's about it! jQuery makes this AJAX stuff prety simple.

Look in the JavaScript file to see how the CSS3 is injected to display the drop shadow.

Conclusion and Download

Although this tutorial may seem pretty hard, it actually isn't. It does really improve the search of your website and when this comes available as plugin for something, it would be really great. It's pretty fun to see too!

Demo Apple.com-style search suggestion   Download Apple.com-style search suggestion

Hope this was useful for you and that you can use this somewhere in your next project. Please share your thoughts!

UPDATE: PHP4 version

Ryan McDonough took the time and effort (thanks!) to create and share a PHP4 version of this script. You can download this version (that doesn't make use of mysqli) from the download section.

When using the PHP4 script, open the SystemComponent.php file and change the variables to connect with the database.

UPDATE: Wordpress Plugin

Daniel Kowalski from IT Systempartner took the time and effort (thanks!) to convert this script into a WordPress plugin called Searchlight. Feel free to visit his site and try it out.


Tags:  apple.com search suggestion mysql php jquery ajax

Interested in this topic? You might enjoy another article I've written called

Did you like this article? Subscribe to my feed or email to keep updated on new articles.

Spread the word and submit to:
Digg!Reddit!Del.icio.us!Facebook!StumbleUpon!
Comments
Add NewSearchRSS
Gaya - Cool Marco   2009-04-02 09:30:47
Gravatar image Hey Marco,

Looks cool man =). Too bad you couldn't implement a little timeout on the query to prevent overloading of your server.
But it looks like a really cool custom suggestion box!
Also. Have you thought about giving results in JSON? So you could do the DOM manipulation in Javascript?
Would make smaller responses and might be slightly quicker for your users.

As always, a nice inspiring post Marco!
Marco - Thanks Gaya!   2009-04-02 09:51:02
Gravatar image Hi Gaya!

Thanks for your comment ;) ! Yeah - Didn't implement the timeout. This article (just like many others here) just show the "Proof of Concept", not fully optimized etc.

If ever anyone will convert this to a plugin/use it on a website, they do need to remember that caching prevents overloading the database - that's why I added it.

I've never messed around with creating JSON, so I can't tell with experience which one is better. I'll make sure to to this in the future!

Greetings,,,
Jape   2009-04-02 11:47:10
Gravatar image Adding my $0.02 in this Grandeurcentered talk. I totally agree with Gaya in that this thing is neat as can be. Also agree that it might be even better if you'd used xml, json or any other structured dataformat for that matter. The purpose of a webservice is providing a language- and platform independent interface for your application. By having it return HTML you're basically limiting it's use to a webbased application.

While i'm at it, it would be so cash if this thing enabled you to use the arrowkeys to navigate through the results, and having the returnkey bring you to that particullar article.

Anyhow, be sure to keep up the good work!
Marco   2009-04-02 12:02:24
Gravatar image Hiya Jape!

Thanks for your input ;) .

Yeah - you're totally right. It just wan't my intension to turn this into a webservice of some kind - Just webbased would do the trick. But indeed; If XML was outputted, it could be used in other applications (although it would also create loads of data load since every time a user presses "down", another webservice call is made).

I was also thinking about the "arrows" functionality (Apple does have that working), so I might give it another shot in the future.

Greetings,,,
Jape   2009-04-02 12:40:39
Gravatar image I think the same webservice call would suffice. It's just a bit of presentationlogic that would have to be added i guess
Gaya   2009-04-03 09:50:52
Gravatar image Adding functionality to the keys would be a nice addition indeed.
Jape thanks for agreeing on the response thing.
It's so good Grandeur still lives in all of our hearts =D
Anonymous - re:   2009-06-22 04:08:09
Gravatar image
Jape wrote:
Adding my $0.02 in this Grandeurcentered talk. I totally agree with Gaya in that this thing is neat as can be. Also agree that it might be even better if you'd used xml, json or any other structured dataformat for that matter. The purpose of a webservice is providing a language- and platform independent interface for your application. By having it return HTML you're basically limiting it's use to a webbased application.

While i'm at it, it would be so cash if this thing enabled you to use the arrowkeys to navigate through the results, and having the returnkey bring you to that particullar article.

Anyhow, be sure to keep up the good work!
Jape wrote:
Adding my $0.02 in this Grandeurcentered talk. I totally agree with Gaya in that this thing is neat as can be. Also agree that it might be even better if you'd used xml, json or any other structured dataformat for that matter. The purpose of a webservice is providing a language- and platform independent interface for your application. By having it return HTML you're basically limiting it's use to a webbased application.

While i'm at it, it would be so cash if this thing enabled you to use the arrowkeys to navigate through the results, and having the returnkey bring you to that particullar article.

Anyhow, be sure to keep up the good work!
Wildo - ASP.net Version Please   2012-08-10 20:41:06
Gravatar image I like your script can you send me please please please
ASP.net version with MSSSQL database or JSON
to my email green_hawk_lb@hotmail.com
chris - Wait for it   2009-04-02 17:19:07
Gravatar image This is very slick!! I'm really interested in incorporating it to my site. I'm using something similar though. As for the timeout idea, I put in a minimum of three characters before executing the query.

I wonder if using something like "hover intent" (jQuery plugin) could be used. But would that affect users who do not wait for search suggestions and just click [return]?
Marco - Thanks!   2009-04-02 18:26:58
Gravatar image Thanks Chris! It called "fancy" for a reason ;) .

The minimum of three characters would indeed help (a lot), especially when you have loads and loads of articles (or products) in your database.

The "hover intent" jQuery plugin could also help - Only when the user "stops writing" for a couple of milliseconds, the call to the database would be made.

There is one problem when using this - How to determine the time? Some people type fast and don't ever see the "suggestion". Some are really slow, but don't actually need it.

As you see (and like others already said), much room for improvement in this script ;) !
Sonny - Plugin   2009-04-02 11:30:34
Gravatar image There is a plugin for Joomla that does the same:
YooSearch

It's a pitty it is payware..
Marco - Great share!   2009-04-02 11:47:14
Gravatar image Hi Sonny!

I wasn't aware of that - thanks for letting me know.

Now other people that want to support the real (free) open source community now can convert my variation to a free extension ;) .
tanie strony internetowe - nice   2009-04-06 14:06:52
Gravatar image nice job, great tut
Simon - Keyboard accessibility?   2009-04-06 19:09:56
Gravatar image Great article, but it's missing one crucial function compared to Apple's: it's not keyboard accessibility. Apple's search allows you to walk through the list using the up and down keys on the keyboard.

Aside from that this is a pretty good rebuild of Apple's search.
Marco - Absolutely true   2009-04-06 19:21:04
Gravatar image Yup, you're absolutely right. As you can see in the comments above, that could be implemented for future use (along with loads of other improvements). I might give it another shot sometime and make sure to add that (superb) functionality to this script.
chandlervdw - Any word on keystroke navigation?   2009-10-28 17:03:40
Gravatar image Any chance you've added this functionality since April?
Marco - Combine with other article   2009-10-29 08:54:19
Gravatar image I already wrote a other article a while ago that does this - you'll need to combine it with this version.

Check it out: Advanced keypress navigation with jQuery. Good luck!
Pradeep - PraisedLight   2009-04-06 19:51:31
Gravatar image Hey Buddy, Apply style search is really cool man. Though I program on jQuery, it sometimes feels good to get some already coded program. In my site, on the music section http://praisedlight.com/music.html, I am trying to implement this feature, currently I am in the process of generating the metadata for search and I have just used your data/table to show results.But my music search should be ready in a day or two. Thanks for sharing your code. Also let me know if you have any suggestion to my website in terms of layout/color/content. Its my personal blog website!
lawrence77 - Amazed!   2009-04-07 22:55:10
Gravatar image :evil: wow!
I love autosuggest always! :woohoo:
Chris - Confused   2009-04-09 16:43:18
Gravatar image Reallly excited to find something like this, and I'm dead pleased with with amount of work that has gone into building this free script.

However, I'm having some issues with overlaying the results box. Right now it just pushes the rest of my content down the page, however, I was hoping to have it overlay over the top of my existing content, I can't but think this is a must-have feature.

If anyone can assist, that would be great!
Marco - position:absolute   2009-04-16 08:02:42
Gravatar image Hiya Chris,

Thanks for your comment and your nice words.

You're totally right: It indeed should "float" over your current content. To do so, add the following CSS to the search results:
Quote:
position:absolute

Now you still need to position it a bit, but it should pop up on the top.

Good luck!
Anuj   2009-06-08 09:38:11
Gravatar image hi

I added "position:absolute" to searchresults, it works fine but am facing other prob. now, as results once come up they don't hide by itself.
can anyone help ?

thanks
Zee   2011-04-16 20:43:16
Gravatar image Sorry to chime in 2 years after your post. Thought this could help a few other folks using this.

you'll need to put these two values in your CSS for the #suggestions style

postition:absolute
z-index: 100

z-index is the stacking order of your elements, i made it 100 just to be certain it would always show on top if I decide to add other things around that area.
DB - thanks   2012-02-25 14:17:21
Gravatar image That did actually help me... thanks :)
Eugene Gregorio - Able to integrate on Careerjet?   2009-04-09 18:16:08
Gravatar image I'm not sure if you guys have experience with Careerjet Search Box (http://www.careerjet.ca/partners/searchbox.html), am I able to integrate this? I want to use their data but use this search box.

Any thoughts?

Thanks
Marco - Complex   2009-04-16 08:00:14
Gravatar image Hi Eugene,

Looking at that page, it would be pretty complex (but of course not impossible) to achieve something that you want.

Once I have a little bit more time, I might want to give it a shot!

Greetings,,,
Jason Robb   2009-04-10 15:59:30
Gravatar image Very cool. It would be nice to see the "press down" functionality, as someone else mentioned. Loads of progress made here, well done! =)

Cheers,
Jason R.
Thomas - Pheew!   2009-04-15 22:20:24
Gravatar image I do not get off screen anymore till this thang is working ;)
Anonymous - re: Cool Marco   2009-04-17 22:46:26
Gravatar image
Gaya wrote:
Hey Marco,

Looks cool man =). Too bad you couldn't implement a little timeout on the query to prevent overloading of your server.
But it looks like a really cool custom suggestion box!
Also. Have you thought about giving results in JSON? So you could do the DOM manipulation in Javascript?
Would make smaller responses and might be slightly quicker for your users.

As always, a nice inspiring post Marco!
Andriy - Please a need!   2009-04-19 09:18:03
Gravatar image How to make search conducted in Cyrillic?

:!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :( Perhaps a need!
mamjed - Search Images?   2009-04-22 00:00:49
Gravatar image i was thinking of implementing this on a site im working on but i dont understand how it displays the images. (im not that big of a developer)
Marco - Database + PHP + Storage   2009-04-22 07:59:43
Gravatar image Hiya Mamjed,

- A reference is made in the database (table: "search", column "img" ). The image name is there (something like "search.png" ).
- When the PHP retrieves the data from the database, it echos the images too.
- The real images are stored in the "search_images" folder

Hope that makes it a little bit more clear - good luck!
Alexander - very usefull   2009-04-23 16:22:38
Gravatar image Thanks for sharing your development man, it really helped me, a lot.

Thanks again, keep up the excellent work

/mega thumbs up
Salvatore - Wordpress Implementation?   2009-04-29 01:27:09
Gravatar image Dude,
this is really awesome, nothing else to say.

Something like this built on a platform like Wordpress would be simply amazing.

How difficult do you reckon it could be to bring your full concept into wordpress?

I'm really curious!

Thanks anyway for showing this, keep up the good work
Marco - Don't know   2009-04-29 08:40:27
Gravatar image Hi Salvatore,

Thanks for your compliment!

I don't know how to tranfer this full concept to WordPress, since I'm not familiar with the CMS (I'm a Joomla! guy ;) ).

I've already heard from WP developers they're working on tranferring this concept to the WP platform. I'll change this article when the plugin goes live!
Jørgen - without mysqli?   2009-04-30 21:45:48
Gravatar image Hi there, I've been trying to get this script to work, but my host doesn't support mysqli. Do you know of a simple way to get this to work without mysqli?

Cheers!
Marco - PHP4 implementation   2009-05-01 10:46:56
Gravatar image When MySQLi isn't enabled, I assume that your host is running PHP4? You really should ask for an upgrade ;) .

Anyway, if you can't upgrade to PHP5, you'll need to use the PHP4 MySQL connector and loop to the "fetched results". Simply search on Google to retrieve the desired information from the database to achieve the same results.

Good luck!
Xaga   2009-05-15 23:19:54
Gravatar image I manage to get it to work without using mysqli. it needs a little bit of editing but it works perfectly. One problem is the dropdown does not appear when the page is secured (https). Any ideas?????????
Marco - Nice!   2009-05-16 09:32:07
Gravatar image Well done Xaga - you might want to share your changes with the rest of us.

As for the "https" version, I don't know why it doesn't work. Does any JavaScript work? If not, it might be because jQuery is called from Google, which is not over https. Try including the jQuery yourself and give it another go!
Marco - Good!   2009-05-16 09:54:05
Gravatar image I'm glad so many people liked this post! Hope to see this script used somewhere else on the web ;) .
Chris - Web Chappy   2009-05-21 10:46:05
Gravatar image 'ello, I'm having a fight with this script at the moment, though I've got it working all correctly, I'm trying to deploy it over the top of some flash, but I' not getting anywhere fast - it works great in most browsers, but IE7 is giving me a real headache, if anyone knows how I could fix this, please help!
Marco   2009-05-21 11:51:43
Gravatar image Placing a DOM object on top of a Flash object is hard - I don't know if it's possible. You could try setting the z-index inside the CSS to 999 to make sure to place it "on top".

What's happening in IE7?
ysai - ie7   2012-07-16 07:10:21
Gravatar image the entire image slideshow is not working in ie7..
Rafael - Great!   2009-05-27 17:45:53
Gravatar image HI, i´m design new layout for my blog

and i want try this "search" in blog (blogger) but i can´t used , please you help me?
Marco - Sorry, can't   2009-05-27 19:52:47
Gravatar image Hi Rafael,

I'm glad you enjoyed the script.

Probably, you can't use this search on Blogger since you'll need to control your own FTP/MySQL to get this technique to work. Blogger is a (free) blogging platform, which doesn't allow this.

Greetings,,,
Interesting - larger databases   2009-05-29 23:29:58
Gravatar image Any tips on what the best approach would be limit database queries for a larger database? Any code samples?

I implemented your idea and it works great but it is a bit slow.

Thanks for the helpful tutorial.
eric   2009-05-30 09:36:08
Gravatar image it's so cool. thank you so much for sharing.
Rafael - THanks!   2009-06-01 18:13:58
Gravatar image Thanks aprecciate !
Ruud - Thnxs!   2009-06-03 12:26:13
Gravatar image Hey Marco,

Thnxs for the amazing script. I modified it so it works with my database. It now searches trough our project names or projectplaces. I replaced the images with small pictures of the project and I categorize the results on project place.

Great job and keep up the good work!
Marco - Great!   2009-06-03 13:35:48
Gravatar image Hi Ruud,

I'm glad you liked my script and modified it in such a way so that it'll suit your needs. That's what I really like to see!

I visited your website, but can't see the implementation of this script there. I really am wondering how it looks like - do you have it online somewhere?

Greetings,
Marco
Ruud   2009-06-03 16:41:49
Gravatar image At the moment am I working on the website of Thunnissen Groep. This part of the project will be released next week.
So check www.thunnissen.nl at the end of next week and look under project. There you will find a searchbox with the implementation of this script.
Ruud - Question   2009-06-05 09:23:21
Gravatar image Hey Marco,

I have a question and I hope you can help me with it. How can I post a second value to the rpc.php? I need to make some sql filters for the search, so I thought with a hidden input field to post the data to rpc.php.

So I have this field:

and I modified the jquery.search.js to this:

function lookup(inputString, proj) {
if(inputString.length == 0) {
$('#suggestions').fadeOut(); // Hide the suggestions box
} else {
$.post("rpc.php", {queryString: ""+inputString+"", queryProj: ""+proj+"" }, function(data) { // Do an AJAX call
$('#suggestions').fadeIn(); // Show the suggestions box
$('#suggestions').html(data); // Fill the suggestions box
});
}
}

But I don't get the data in rpc.php (where I catch it this way: $proj = $_POST['queryProj']; )

Do you have any idea how I fix this?
Marco - Strange   2009-06-05 09:32:10
Gravatar image Hi Ruud,

Strange, your code seems valid.

Could you please contact me using the contact form so we can discuss this problem a little bit more? Otherwise we'll have a big conversation on this page :P .

Greetings,,,
Christopher Sladdin - Search on top of Content like at Apple   2009-06-12 09:34:10
Gravatar image Hey - I noticed when using the search the other day that the suggestions box pushes all the other content on your web page down (text, etc) so that there is enough space for the suggestions box. How can I make it possible for the suggestions box to fit on top of all the content therefore not increasing the page length by moving the content down. The Apple website does this beautifully and wondered if anybody could help with this. Thanks
chandlervdw - re: position:absolute   2009-11-04 19:10:00
Gravatar image
Marco wrote:
Hiya Chris,

Thanks for your comment and your nice words.

You're totally right: It indeed should "float" over your current content. To do so, add the following CSS to the search results:
Quote:
position:absolute

Now you still need to position it a bit, but it should pop up on the top.

Good luck!
Arko - Is someone using this in osCommerce?   2009-06-13 18:44:12
Gravatar image Great work! I would love to use this in my osCommerce website but don't have the skills to apply this. Did someone manage to use this together with osCommerce?
lossendae - Awesome   2009-06-17 12:37:31
Gravatar image I'll probably try to create a snippet for modxcms using you're code as a base.

Great plugin!
Ben - Awesome   2009-06-18 18:52:39
Gravatar image Hi Marco - This is great, i love it and will steal with pride!

I just wanted to say thanks for your efferts..
This is an awesome bit of code looking forward to more!

Cheers

Ben
Marco - Haha!   2009-06-19 08:26:39
Gravatar image Thanks for your compliment Ben ;) .

It's placed online to "steal", so feel free to implement it where you want! Good luck :)
Jørgen - Got it working..   2009-06-22 12:21:45
Gravatar image Well, I got it working on my site :)

However, in Safari there's a white drop-shadow that appears below the dropdown box.. I can't find it in the CSS, how can I get rid of it?

Cheers!

Jørgen
Marco - JavaScript file   2009-06-22 14:19:17
Gravatar image Hi!

As you can see in the article, the drop-shadow effect is injected using JavaScript.

Simply open the script.js file and change the "box-shadow" properties.

Good luck!
Jørgen   2009-06-24 11:59:39
Gravatar image Haha, thanks! Must remember to always read the instructions.. :)
Vittorio - Arrow keys navigation in searchresults div - Apple   2009-07-01 17:39:41
Gravatar image Hi marco! This is great i love it.
I have a question and I hope you can help me with it.
How can implement the Arrow keys (up arrow & down arrow keyboard) navigation in to the div of results? Style Apple.com.

Thanks!
asd   2009-07-01 21:53:20
Gravatar image Hey Vittorio, I spent a long time, and i used javascritpt. It was pretty hard, but I still managed to do that, now it works perfectly!
Vittorio   2009-07-02 16:21:03
Gravatar image Hi asd, an example please.
carsten - good work   2009-07-31 15:59:14
Gravatar image hi marco,
great job that u done.

i have a problem with the sql he is shown me the error:

atal error: Cannot instantiate non-existent class: mysqli in /home/www/web120/html/wp/wp-content/themes/wp_slider/search/rpc.php on line 5

have all user data in the php.

thanks
carsten
Marco - PHP version   2009-07-31 16:25:42
Gravatar image Hello carsten,

Thank you for those kind words.

Which PHP version are you using? mysqli only works in PHP5 - PHP4 will give errors and you'll need to retrieve the data another way.
carsten   2009-07-31 17:34:40
Gravatar image Hello,

our server is running php5. i think hes is not receive any data form the sql file. but i have filled all data out.

thanks
carsten
Marco - Contact me   2009-08-01 02:07:35
Gravatar image Hello,

Could you contact me through the Contact page so we can discuss this some further?

Thanks!
Mehedi Hasan - WOW!!!! Great Post   2009-08-07 07:36:53
Gravatar image Thanks for sharing... Its a very helpful post for me.
Ryan McDonough - PHP 4 Version   2009-08-12 12:45:30
Gravatar image Hi everyone,

I've edited the code to make it work with PHP4, but still retains it's OOP style.

You can download the code from: http://ryanmcdonough.co.uk/applephp4.zip

Or you can wait till Marco has reviewed the copy I sent to him to make sure there is no problems he can see with my changes and download it from him if you're dubious heh.
Sharif - Creative Articles for your site.   2009-08-13 09:17:55
Gravatar image Its nice & working :)

Thanks. Learned a new style :D
Ben - Jquery Version   2009-08-13 19:16:04
Gravatar image Hi Marco,

I'm still playing about with this feature and some other cool jquery effects for my site. In ther interest of not loading different versions of Jquery i've noticed the following.

http://www.google.com/jsapi
- Referenceing this version of Jquery everything works great.

http://code.jquery.com/jquery-latest.pack.js
- Referencing this version, which i think should be the most current? there is a problem. When the user loses focus on the search box the suggestions still appear, which is not ideal.

Like i said, its not ideal or effecient to load two versions of jquery - do you know of a fix?

Many thanks

Ben :lol:
Ben   2009-08-14 17:51:32
Gravatar image Ah! I should do some reading first before posting...

They both do different things:

Get the necessary Ajax stuff required for your search feature.

and this

gets the latest Jquery library. Which allows your search feature to work but doesn't turn it off when you mouse out of the area..

Sorry for my confusion..

Still loving it BTW
Ben
Ben   2009-08-14 17:53:24
Gravatar image - Code part was removed - should read

They both do different things:

http://www.google.com/jsapi - Gets the necessary Ajax stuff required for your search feature.

http://code.jquery.com/jquery-latest.pack.js - gets the latest Jquery library. Which also allows your search feature to work but doesn't turn it off when you mouse out of the area..

Sorry for my (double) confusion..
Ben
Pim Linders   2009-08-30 00:41:24
Gravatar image Great plugin! I adjusted the php code to pull in data from an xml file but I need a delay of some sort since it takes some time to get the actual xml file (1.2 seconds usually). I noticed some people talking about a delay above, did any one succeed in doing so? I tried timeout but that still sends all the queries. Is there any way to detect if the user is still typing?
Pim linders   2009-08-30 05:20:42
Gravatar image I was able to delay it using this

var key_count_global = 0;
var timer; // Global variable
$("#inputString";).keyup(function(){
$('#suggestions').fadeIn();
key_count_global++;
clearTimeout(timer);
timer = setTimeout(function(){ lookup() }, 800);
});

works great!
Sam   2009-09-07 22:33:32
Gravatar image Hey Pim: Can you tell me where exactly this code goes for those of us who are js challenged? Thx.
Pim Linders   2009-09-25 23:19:05
Gravatar image I'm using it on the site i'm building http://www.bestsellprice.com you can look at custom.js to see how I implemented it.
Shane - Search to right   2009-09-02 17:03:16
Gravatar image Hi, the script is great! I'm trying to implement it on my parents website. I have no prior knowledge of SQL so had to learn but got the search working. It works perfectly if I use the index file from the download (.com/apple/index.html) but as soon as I move the search box to my own web page (/index1.html), the search results don't line up with the search box and the css is being interfered with by my main stylesheet.

Can anyone help? Much appreciated!! :) The test site is at www.southernchauffeurservices.com/index1.php

Thanks!
Marcus - Why the inline function call?   2009-09-04 23:06:34
Gravatar image Why use an inline function directly in the html when you can do it all simply and unobtrusively with jQuery?

Either put an id on the text input and reference that directly with
$("#yourId";).keyup(function() {})
or if you keep the html
$("#searchform input:text";).keyup(function() {})
Tim - I do not be running   2009-09-06 00:39:13
Gravatar image Looks really good, but I get it somehow not quite the run, at least not the way I imagine it
Lee Wilson - Anything for Joomla?   2009-09-14 12:03:58
Gravatar image Nice plugin, anyone got it working with Joomla 1.5? I know there is a plugin by Yootools, as mentioned by a previous user, but they use mootools, anything available for jQuery and Joomla.

Any talented Joomla/jQuery people who may be thinking of porting, there will definitely be a market for this.

Thanks
Shane Walsh - Pushing other content down   2009-09-25 15:08:57
Gravatar image Ok well when i first noticed that search results was pushing my other content down i added the following CSS to #searchresults

Position:Absolute
Z-index: 1

And it worked! Its just a tad bit slower.. Hope this Helps!
Shane Walsh   2009-09-25 15:17:43
Gravatar image also add

Position:Absolute
Z-index: 1

to

#searchresults a:hover

and there ya go!
Shane Walsh   2009-09-25 15:48:26
Gravatar image also if you find that you are getting slower reaction set what ever content it is that is being pushed and set its z-indez to -1 as someone else said here!
Ivan S.   2009-09-30 19:30:56
Gravatar image Hi, I just want to now how bad is overloading of server with this search?

Is there anybode how implemented this into website?

Thanks
Ivan S.   2009-09-30 20:24:58
Gravatar image Just to correct myself:

Is there anybody who implemented this into website?
Simon - amazing   2009-10-26 11:58:12
Gravatar image This is awesome, thankyou!
Brian - Place Search Results Over Flash   2009-11-06 19:47:20
Gravatar image Marco,

Thanks a lot for this amazing script. I'm having troubles because the search box is hidden behind some flash content. I read your comment that it's hard to place a DOM object above flash. What if the entire screen is grayed out and made inactive while the user is searching? Will this hide the flash content?
Nick Jackson - Awesome, thanks!   2009-11-09 03:01:22
Gravatar image Thanks for providing a great starting point for my own implementation - now all I need to do is fix the CSS to get the box where I want it!
justintime   2009-11-11 01:33:39
Gravatar image "Apple.com-style" as if they invented this search as you type concept...hahaha, next time use more Apple lipstick. Steve is listening and all puckered up. :whistle:
Ryan McDonough - I have implemented this   2009-11-12 10:21:30
Gravatar image Obviously I implemented this, for a university I contracted with:

http://www.ioe.mmu.ac.uk/cpd/

You can see it there, I'm also going to implement this on a internal site, I maybe able to provide screenshots for that but not a link.
Luis Silva - Problems with mootools   2009-11-21 20:02:13
Gravatar image Hi,
Great script.

I'm trying to use with joomla but is not working, the error is related to mootools don't support some function.

Help me to resolve this.

thx in advance.
Scott Richardson - Not getting any results!   2009-12-22 15:06:25
Gravatar image HELP! Guys, I have installed the script as suggested. But I'm getting no results. The only thing that appears is the empty . None of the PHP appears to be working, and it's not even displaying the link to the site map, which should display no matter if there are results in the DB or not. I have added several test items to the DB too.

HELP!

see here:

http://www.retainingsolutions.com.au/test/searchtest/

and here:

http://www.retainingsolutions.com.au/test

second link is where the search will be implemented when complete.

Any help is greatly appreciated!
Scott Richardson - OK fixed it   2009-12-23 01:20:16
Gravatar image OK never mind.. the web host had set up the mysql database address incorrectly. All fixed now.

However i have one question.. how do you stop it from trying to directly access the script if the user presses enter?
Arszy Stialandres - Help with IE7 Problem   2010-01-06 10:16:27
Gravatar image Hi Marco,

Great script and i already implement it on my site, but i have a little problem, you see in firefox it works fine but when i open in IE7 the result seems terrible ... like it dont get the css.

here's my site : http://pertamax.pertamina.com/

could you help me out here ... thanks a lot
Eric Di Bari   2010-01-15 01:18:34
Gravatar image Great tutorial. Thanks.
Mike - div overlay   2010-02-01 11:05:55
Gravatar image Great tutorial!

I've got this to work using the original version, however when I search something, the results panal pushes the rest of my page down.

Is there any way to get it to overlay the page link on the Apple site?

Thanks
Anonymous   2010-02-07 17:48:18
Gravatar image anyone have a code example on .net/c# with XML as the data?
Mike - Updating Database   2010-03-06 04:18:56
Gravatar image Hi. This is a really cool code.

But how can I add data to the database?

I am using this code in the processing section:


$cat_id=$_POST['cat_id'];
$name=$_POST['name'];
$img=$_POST['img'];
$desc=$_POST['desc'];
$url=$_POST['url'];

mysql_connect("localhost", "XXXXX", "XXXXX";) or die(mysql_error());
mysql_select_db("XXXXXXX";) or die(mysql_error());
mysql_query("INSERT INTO `SEARCH` VALUES ('$cat_id', '$name', '$img', '$desc', '$url' )";);




There are no errors, but when i check the database, nothing is added.

Thanks in advance
Ryan - Very Useful - Query ?   2010-03-10 00:03:10
Gravatar image Not sure if it was supposed to but it isn't considering the desc db field in the search. How would I ad that and maybe ad preference to the name field over it?
Gayan - Hey , Can we intergrate this to 4images ?   2010-03-14 06:09:37
Gravatar image :woohoo: hey .. can we integrate this to 4images ?
im not that much good at
danin - Is it possible to implement same effect in Django?   2010-03-29 07:20:17
Gravatar image Hey Hi Marco,
really nice feature. B) . Right now I am working on Django framework in python. DO you have any idea about implementing same effect over there??
Thanks
keshav - PHP Web Developer   2010-04-15 15:28:19
Gravatar image how to make select given suggestion by up arrow or by down arrow. right now user have to select given suggestion by mouse, then what means of auto suggest? afterall user have to use mouse.
please make it more user friendly
ismaa   2010-04-29 00:44:14
Gravatar image great tutorial . thanks for sharing .I wonder if it's allowed to clone apple search system for another website ? do i risk being sued by apple ? :)
Anyway i have found another fancy search system using php /mysql and jquery here :
http://youhack.me/2010/04/28/creating-a-fancy-search-feature-with-php-mysql-and-jquery/
Chris O - Great menu but need some help   2010-05-11 20:38:58
Gravatar image Hey,
Would just like to say thank you very much for this search menu. I have it all working ok but if I click somewhere else on my page it isn't closing the list. Just wondering if someone else has had this or knows how this is working?
Ivan   2010-05-12 14:51:22
Gravatar image Great script, thank you very much!

Trying to implement it into SilverStripe CMS, stacked with "There should be no direct access to this script!". Since i'm a total newbie, can anyone point me, which direction should i digg? :lol:
Mags   2010-05-12 19:00:07
Gravatar image Hi Marco. Great script and I've got it working fine in IE7/8 but am having problems in Firefox and Chrome. I have implemented the CSS mod to get the drop down to float over my page but the links in the drop down now don't work, apart from in IE. Any ideas please?
Astematur - Personel Ta   2010-05-13 21:04:51
Gravatar image very nice cod. Thanks.
Milan - Acces php from remote server   2010-05-30 15:10:22
Gravatar image Hi Marco,

Thanks for the great script!

I have one question: is it possible to execute the php file from a remote server? My index.html is located on a different server than the mysql database and I can't seem to get the script to work that way..

Maybe you know how?

Thanks,

Milan
Milan - Fixed it   2010-06-03 12:35:04
Gravatar image It works now, i used json for the datatransfer.
Ross - jquery 1.4.2 focus loss issue   2010-06-07 17:17:18
Gravatar image Hey

Very nice script you have here, very well through out and implemented, one issue though..

The

Code:

// Fade out the suggestions box when not active
$("input";).blur(function(){
$('#suggestions').fadeOut();
});


Javascript does not work in jQuery 1.4.2, the newest one to date. Do you know of any reason for this? I have been looking around and have tried some different implementations of it but its still not happy and refuses to fade the list out when focus on the input element is lost.

Any ideas?

Other than that great script, any help would be very much appreciated :)


Thanks
Ross - RE: jquery 1.4.2 focus loss issue   2010-06-08 18:02:00
Gravatar image Hey, I have sorted the "it won't fade the list out when focus on the input field is lost." problem.

This is for anyone else who has the same issue.

Basically, as I am not familiar with Googles Ajax API I failed to notice that the google.setOnLoadCallback(function() in the script.js file is equivalent to $(document).ready(function(). As I was using my own copy of jQuery (and had therefor removed Googles API code), to fix it, I had to place the loss of focus section of code

Code:

$("input";).blur(function(){
$('#suggestions').fadeOut();
});


into a document.ready.

It was not a jQuery compatibility issue at all, I assumed to quickly that it was :)


Thanks
abdee - question   2010-06-08 13:03:00
Gravatar image I want to apply this on localhost, but not working, what is influenced by google jsapi?? if so, whether there are examples jsapi to localhost? Please help :)
Magz - job   2010-06-19 10:09:13
Gravatar image I'm going to have a try at this, looks a little tricky but worth the effort, big thanks for posting the tutorial!
Aildad Modjtabai - problme with code   2010-07-23 20:36:57
Gravatar image Hi, i have donwload your code and installed on my computer for testing, i have setup database and connection works great.
when i was going to tested in search text box in index.html, is not showing any thing but getting error message said line 15 in index.html has errors.

any idea!

please help thanks.

AM
Milan - Works great :)   2010-08-09 11:33:00
Gravatar image :lol:

I implemented it in my RC Toys website and it works like a charm!

Check it out: radiografisch speelgoed: http://www.radiografisch-speelgoed.net

Type a letter in the searchbox and you'll see!

Regards,

Milan
sp   2010-09-13 18:12:01
Gravatar image Would it be possible to let javascript look-up an xml file and return the results in this format?

Leaving out php and a database.
Martin   2010-09-27 23:35:15
Gravatar image I'm trying to convert this in classic asp.
But I just get the 8 first posts, no matter what i search for. A search for XX gives all 8 first post. .Same with a search for CITY.
Can someone help me find correct value so I can retrieve correct data from MySQL?

Code:
'sokord = request.form("sok";)
'sokord = request("inputString";)
'sokord = request.queryString("inputString";)
'sokord = request("";)
'sokord = Request.form("inputString";)
'sokord = request.form("";)
'sokord = request.querystring("sok";)
'sokord = request.querystring("id";)
sokord = request.form("id";)
Martin   2010-09-28 08:39:18
Gravatar image The correct answer is

Code:
sokord = Request.Querystring("queryString";)
Wildo - Please share with us   2012-08-10 20:42:57
Gravatar image Please share with us your ASP.net version with MSSQL or JSON


you can send to my email green_hawk_lb@hotmail.com
thanks appreciate your help
sameel - asp.net   2012-06-24 08:45:04
Gravatar image Hi Martin. Please send me asp.net code. How can I do it?
Wildo - I need help with ASP   2012-08-10 20:38:20
Gravatar image Did you manage with the ASP.net Version?

can someone send me a working sample demo for ASP.net
with database or JSON

many thanks,
Martin   2010-09-27 23:42:39
Gravatar image And another question. I have several Jquery-scripts on my page.
If I use ,
the other scripts wont work?
How to just use jquery-1.2.6.min.js?
Michael Lopez - Fap Turbo   2010-10-05 12:19:41
Gravatar image Nice listing! Thanks for the information!.. Great staff! And great source too
Mauro Laurent - re: RE: jquery 1.4.2 focus loss issue   2010-10-06 21:54:51
Gravatar image So, for others users stop scracting their heads between the use of googleAPI and simple offline Jquery, here's script.js ready for offline use.

Keep in mind you still have to have a reference to Jquery in your HTML (i know, i know, some people will say, well duh!, but really, people sometimes miss that)


/*
* Author: Marco Kuiper (http://www.marcofolio.net/)
*/

$(document).ready(function()
{
// Safely inject CSS3 and give the search results a shadow
var cssObj = { 'box-shadow' : '#888 5px 10px 10px', // Added when CSS3 is standard
'-webkit-box-shadow' : '#888 5px 10px 10px', // Safari
'-moz-box-shadow' : '#888 5px 10px 10px'}; // Firefox 3.5+
$("#suggestions";).css(cssObj);

// Fade out the suggestions box when not active
$("input";).blur(function(){
$('#suggestions').fadeOut();
});
});


function lookup(inputString) {
if(inputString.length == 0) {
$('#suggestions').fadeOut(); // Hide the suggestions box
} else {
$.post("rpc_arti.php", {queryString: ""+inputString+""}, function(data) { // Do an AJAX call
$('#suggestions').fadeIn(); // Show the suggestions box
$('#suggestions').html(data); // Fill the suggestions box
});
}
}
Mauro Laurent   2010-10-06 21:59:40
Gravatar image Just one thing here i forgot to take out: rpc_arti.php must point to your custom php.

By the way, i used this with ORACLE OCI and PHP 5. The customization that this script allows is endless.

Great work Marco! Thanks for sharing it with the world.
prole - jquery 1.4.2 focus loss issue   2011-01-27 12:47:56
Gravatar image Hello,
I changed google.load("jquery", "1.3.1";);
google.setOnLoadCallback(function() with $(document).ready(function() in script.js, then I include in my index.php
instead of , but then script wont work. When I typed letter it doesn't show anything. Dear Mauro Laurent, please help :)
Keith   2012-08-27 07:04:44
Gravatar image Hi there,

How did you change all the mySQL to Oracle stuff? Would you be able to help me with that?
Anonymous   2010-11-24 14:28:24
Gravatar image :whistle: :huh: :kiss: :pinch: :s :unsure: :woohoo: :pinch: :X <img src=hock:' /> :( :angry: :0 :angry: :confused: :cheer: B)
Motorverzekering vergelijken   2010-11-30 14:17:06
Gravatar image Pretty awesome! I love how small the JQuery part of it is. Very creative :D

Greets,
M. Vergelijken
Christopher Gardner - Issue with IE7   2010-12-01 19:21:09
Gravatar image Lovely Search function, love it and used it myself.

Folowed the advice about position:absolute

in order for the search content to overlap contents, however i'm up against the problem that the search criteria links generated do not work when clicked in IE7, but work in safari and chrome?

Tried the demo in the same vrowser and it worked hoever it does not have the position:absolute function written in so i'm guessing this is the problem, any ideas guys?

Thnaks
lee - bug   2010-12-16 11:27:05
Gravatar image but, i have to say that your website has something wrong in my explorer,mine is chrome,
rc-auto - rc-auto   2011-01-02 14:10:17
Gravatar image good search function for on youre website
shahram   2011-01-02 19:40:38
Gravatar image thank you for your masterpiece
i have a problem would you help me.
i wanna change the language to persian(Iran) but i don't know what should i do .
Andriy - It script have not work in IE7/8   2011-01-27 18:39:33
Gravatar image Hi,

It script have not work in IE7/8
What is corrected for it script work in IE.

Thank you very much!
prole - Problem with dropdown links   2011-01-28 11:21:14
Gravatar image Hello,
I was experiencing problem with dropdown links - when I modified script.js and put $(document).ready(function() and add position:absolute and z-index:999; in #searchresults, I wasn't able to click on any of links. But if I removed z-index:999; everything is fine, except that my jquery accordion (which is just below search form) is in first place, not search results.
I inserted into script.js next line: $("#suggestions";).css({'z-index' : '999'}); below $("#suggestions";).css(cssObj); and removed z-index from css - and voila- everything is perfect.
Greetings once again to Marco for this great plugin.
skolozhabskiy - It script have not work in IE7/8   2011-01-28 12:24:50
Gravatar image Hi,

Script not work in IE.
How I can modify code what it work fine?

Thank you very much
Asanka   2011-01-29 17:20:24
Gravatar image great tutorial . thanks for sharing
Fredrik   2011-02-02 11:58:38
Gravatar image Very good article, but I also have problem for it to work on IE
Mohammad Farrukh - Not Work in IE   2011-02-10 07:30:39
Gravatar image Hi !
There are many people who faces the problem in IE7 or IE8. But Still No Reply from admin.

Kindly send us the any solution for that.
Wiyono - Auto sugest   2011-03-06 15:38:27
Gravatar image I try this form...
http://www.misha-tattoo.de/content/suche/index.html

But nothing happend, can you help me please?

You can send via email or here...

Thank you so much...
Milan - It does work in IE   2011-03-07 10:57:04
Gravatar image It does work in IE.....
Rita Barberá   2011-03-17 01:10:45
Gravatar image what ie version?
UKSherm - Change search   2011-03-27 21:20:15
Gravatar image Hi there, is it possible to change the serch field from name to desc. Casual script playing so sry if a very basic question for some.
Fedis - GOODS   2011-04-03 00:40:07
Gravatar image very very very goods! B)
!UA!
babara - Active   2011-04-08 09:18:48
Gravatar image this feature helps viewers so much in find correct keywords, love it ^_^
DSchragg - Other uses?   2011-04-08 12:17:12
Gravatar image This is very cool....Could something like this be applied to say Magento for sorting products within the catalog? This would be a really slick way for customers to view products on a cart site......
Timi Dale - overflow:auto - scrolling issues   2011-04-08 13:47:10
Gravatar image Hi Marco,

Very good job you have done with this.

I have a little problem though: I have set width and height for the search results container and made overflow:auto, such that if search results are longer than the set height a scroll will appear. But when I try to scroll on the results, the container with the results simply disappears.

I've tried tweaking but can't get it to work correctly.

Do you have an idea what I should do to make the scrolling work?
balu - chandragirai.com   2011-04-11 04:49:33
Gravatar image balajibalaji
Nutritionist Brisbane - Good   2011-04-13 00:31:03
Gravatar image This website is actually intriguing. You actually carry right up some fantastic points about the post
shahram - search through desc   2011-04-17 19:48:44
Gravatar image How can i change the code to search through desc column?
amirhossein - Embeded search suggestion   2011-05-15 07:56:05
Gravatar image how can to use that without internet?
(i should include which JavaScript files?)
AlborzHosting   2011-05-22 07:10:32
Gravatar image not any idea for use this suggestion without internet?
Shahbaz - Best Website   2011-05-28 20:30:13
Gravatar image A great Toutorial
Orlin   2011-06-17 09:20:10
Gravatar image Thank you! Great script.
Ryan Boehm   2011-06-18 19:58:49
Gravatar image Great tut. How would you get the menu to slide up when the mouse leaves? (Instead of having to click outside to get the menu to disappear)
hirmani80 - Web Hosting Pad Review   2011-08-02 09:14:14
Gravatar image Good posts are providing the nice info in this blog and I am very much interesting info in this website. This is very great technology is visible in this website and that to adding the two things in this blog. It was really very happy for using the nice info in this blog. Thanks a lot for using the nice info in this website and using the great technology. I was really happy for this info.
markus - timeout   2011-08-19 07:32:02
Gravatar image hello,

thanks for the great tutorial. is there a possibility to get a timeout example? So that the request is sent just once a second?

thanks a lot!
Josh - spinner   2011-09-14 00:25:00
Gravatar image hey marco,

love the script!

i added a spinner within the search field so the user can see that an ajax call is in progress in case there is database lag.


$(document).ready(function () {

$('#loading').bind("ajaxSend", function() {
$(this).show();
}).bind("ajaxComplete", function() {
$(this).hide();
});

});




chasefornone - Thanks very much   2011-10-05 13:33:17
Gravatar image It is really funny,thanks for sharing!
Gabriel   2011-10-10 09:33:16
Gravatar image I have 3 tables to search in (all 3 with similar fields), but it doesn't search, it always work if only one is set. I tried with an array but i get the same ERROR: There was a problem with the query. I don't know where i did wrong :)

The code is:
"SELECT * FROM table1 s, table2 s, table3 s JOIN categories c ON s.cat_id = c.cid WHERE title LIKE '%" . $queryString . "%' OR content LIKE '%" . $queryString . "%' ORDER BY cat_id LIMIT 25"
Roger - joomla virtuemart with this search box !   2011-10-13 06:39:08
Gravatar image joomla virtuemart with this search box !
I found the code in a forum some where, but I forgot where!

ishoppe4less.com

I was wondering why it flickers as you type a search keyword?
ReBeen   2011-11-05 04:10:52
Gravatar image Your website using joomla source? Custom search so nice :)
mahasish shome   2011-10-13 13:56:32
Gravatar image awesome tutorial..its so easy...
adsenz   2011-11-04 14:22:35
Gravatar image Thanks for sharing. :lol:
ReBeen - Rebeen Network   2011-11-05 04:01:45
Gravatar image The best tutorial search custom! Thank so much :)
Gabby - Hebrew lang show ????????? result   2011-11-19 09:13:07
Gravatar image Hi
this script save my life
i use it to search for product and option to add to cart directly from search
i have one problem my result show ?????
do to hebrew lang
any help?
thanx in addvance.
Gabby - found it   2011-11-19 13:56:55
Gravatar image $db->query("SET NAMES 'utf8'";);
iain - webhost shuts it down lol   2011-11-20 21:25:36
Gravatar image Cool script, fairly easy to tie into our database and get running... Though our host keeps shutting it down - to big of a load i guess.

Any way to cache the results? THAT is way over my head.

Thanks,

Iain
Andrew - Conflict with other .js file or mootools.js   2011-12-10 17:23:23
Gravatar image Hi !
How to solve the conflict with other .js files and mootools.js library ?
Thanks !
Saroj Roy   2011-12-13 07:16:48
Gravatar image

The example is great, this will be a great help for me. Thank you very much.
me   2012-01-02 16:07:07
Gravatar image how do i tell it to also display the image next to the name ? or a link and etc ?
Cody - Multi Search   2012-01-10 03:17:52
Gravatar image Hi Marco, :cheer:

First, you are a legend and thank you for sharing !!

Question: How would i search the desc and the name as well ?

I am new and cannot work out how to do it in the SQL command in the rpc.php

Cody :cheer:
onliner - Thanks   2012-01-15 19:15:25
Gravatar image Made things much clearer indeed.
Prole - Multi columns search   2012-01-20 09:41:01
Gravatar image Hi,
Is it possible to search thru multiple database tables? A lot of people is asking this.
Thanks,
Mark - Any luck yet?   2012-03-13 12:53:42
Gravatar image Have you got it to work with multiple tables?
Prole - Multi columns search - answer   2012-01-20 10:10:16
Gravatar image I to not know why, but if you change "name" into "desc" to search ( "SELECT * FROM search s INNER JOIN categories c ON s.cat_id = c.cid WHERE desc LIKE '%" . $queryString . "%' ORDER BY cat_id LIMIT 8" ) it would give ERROR: There was a problem with the query.

But if you create another field in the table "search", for example "description", script work without any problems.
This will search both name and description fields.
"SELECT * FROM search INNER JOIN categories ON search.cat_id = categories.cid WHERE description LIKE '%" . $queryString . "%' or name LIKE '%" . $queryString . "%' ORDER BY cat_id LIMIT 8"
Content of description could be same as desc.
I hope this helps and it works fine for me.
Greetings,
Prole
zach - author should change the column name   2012-04-25 15:46:29
Gravatar image Yeah, it was a bad choice to use "desc" as a column name, since this is a reserved word in SQL. I would suggest that everyone using this Apple search (which, btw, is GREAT - thanks so much for posting it!) change the column name to "description" when creating the search table as well as the line in rpc.php to $description = $result->description;
Cody - Highlight found Search String   2012-01-25 05:12:06
Gravatar image :cheer: Thanks Prole :cheer: the SELECT statement worked Thanks :cheer:

Any idea how we can "Highlight found Search String" ?

So user can see what has been found, just like when you do a Find on a website.
Jamie - Images   2012-04-03 05:49:51
Gravatar image Excellent Thanks.

One problem. If there is no image to display, how can I display a default image ( no_image.jpg ) instead of just showing an error cross?

Thanks.
Yash   2012-04-04 06:12:56
Gravatar image Really a good topic you raise.
Great article buddy keep it up!
Thanks for tha

www.mobitily.com
Sreekanth - Help to use this with .net 4   2012-04-28 05:25:47
Gravatar image Very good artical....
Can you guys please help me to implement this using WCF Restful service as the source of data that returns JSON data. This is a urgent requirement that need to be complited by next week.

Thanks,
Sreekanth
saphire - whitout mouse   2012-04-28 14:35:53
Gravatar image how to use this by using keyboard only.
ia mean how can i click dropdown items by using keyboard up and down keys? and go up and down using these keys too..
Axel Kishore - adding image   2012-05-29 02:56:10
Gravatar image how did u add the image file in the mysql table??? i am new to this i dont know how to do this. this looks awesome but... i am confused. is there any video tutorial of making this or can anyone make a video pls help me
READ ME - Help   2012-06-19 02:27:17
Gravatar image Mr Marco I Loved The Search Box And I'd Would Love To Add it To My Site But The Codes Don't Work Do You Have A Way Of making it in HTML Plz notify Me
Admin - i want help for create same style search engine   2012-07-02 22:07:09
Gravatar image i want help for create same style search engine for my website please help me for create PHP file for this type of database attached images please view this images and help me. WITHOUT IMAGES IN SEARCH.


Posted imagePosted image
Admin - proper images   2012-07-02 22:10:27
Gravatar image Category Image

Posted imagePosted image

Links Details

Posted image
Marcel   2012-07-15 18:54:07
Gravatar image Add

Code:
var delay = (function(){var timer = 0;return function(callback, ms){clearTimeout (timer);timer = setTimeout(callback, ms);};})();


in front

add
Code:
delay(function(){

between
Code:
else{
and
Code:
$.post

and add
Code:
},100);
before the 2 final
Code:
}}


Delayed.
I use it with a document.ready instead of
Code:
google.load("jquery", "1.3.1";);
google.setOnLoadCallback(function()
fiyat - Help please   2012-08-01 14:24:00
Gravatar image can you tell mu how can i use this keyboard cursor keys.
when someone seach a word and want to go up and down between the results by keyboard up and down keys.
or this works only mouse click
Keith   2012-08-27 11:28:31
Gravatar image Hi there, this is a fantastic article but I am having some serious problems changing all the mySQL code to work with an Oracle database. Is anyone able to help me to change the code to use OCI functions instead? I've been playing around with it for days now and can't get it to work. I can only get an empty search result box up, I can't seem to pull the data from my database using the OCI methods I thought were equivalent...
Entertainment Blog - I wanna invite you to be an admin to help me desig   2012-09-02 09:15:27
Gravatar image Hi admin, i've read this guide and it's really interesting. But the important thing is that it's still not working.

http://1.bp.blogspot.com/-Hm1yOHBEUWE/UEMi-MqDTWI/AAAAAAAARwg/i8GJXxoS02s/s1600/search.bmp

I really want to invite you to become an admin of my blog to help me design this. Please give me a comment at http://tanchau123.blogspot.com soon as you can :)
a - a   2012-09-03 08:21:22
Gravatar image a
Anonymous   2012-09-15 13:05:44
Gravatar image ko;kl;
Temir - select result   2012-11-01 06:42:03
Gravatar image if you also added scripts on how to select search result with arrow key that would be cool
Usukhbaatar - Thank you.   2012-11-27 06:49:41
Gravatar image It is very nice. Thank you.
JM Créa   2012-12-21 13:42:20
Gravatar image Certainement le meilleur système de suggestions !!

Very nice :)
galih - Nice   2013-02-17 10:42:01
Gravatar image Very nice search suggestion. I like it. :D
sarah - So cool   2013-02-22 02:32:27
Gravatar image I like this
Thanks for the code and the demo
I'm so going to use this
sarah - So cool   2013-02-22 02:33:42
Gravatar image Ajax request failed.
Gus - ie7 FIX   2013-05-08 03:56:35
Gravatar image IE 7 FIX: Delete this line:

Gus   2013-05-08 03:57:36
Gravatar image script type="text/javascript" src="http://www.google.com/jsapi"...
Gus - re: ie7 FIX   2013-05-08 03:57:10
Gravatar image script type="text/javascript" src="http://www.google.com/jsapi"...
Read more...
Name:
Email:
  Gravatar enabled.
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 
Security Image
Please input the anti-spam code that you can read in the image.
Unsubscribe from e-mail notifications.
 
< Prev   Next >
Subscribe

Subscribe to Marcofolio