We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Live Search Plugin

Development and Programming

Pascal Kriete's avatar
Pascal Kriete
2,589 posts
16 years ago
Pascal Kriete's avatar Pascal Kriete

Florian,

Our forum xss filter will remove <script> and </script> if you try to put them in a post, hence the * - replace it with an i.

That first line of code goes into the template that you filled with php. That tag does the actual processing of the post request when you start to search.

       
florian's avatar
florian
395 posts
16 years ago
florian's avatar florian

Oh wow. Thats great! It works. I added the line to the page with the php and updated the scr*pt with script. This is so awesome!

Now I am going to update this script so that I can pull from 3 weblogs and from 10 different custom fields. 😊

Thanks so much!

       
florian's avatar
florian
395 posts
16 years ago
florian's avatar florian

Hey Pascal,

I successfully extended the plugin to pull from three weblogs. The autocomplete works great but I would like for the autocomplete search window to disappear when I click somewhere else on the page. Right now it seems the only way to get rid of the window is to delete the entered search characters. Any ideas of what I’d have to add to the plugin?

thank you, kindly Florian

       
Pascal Kriete's avatar
Pascal Kriete
2,589 posts
16 years ago
Pascal Kriete's avatar Pascal Kriete

That’s odd, works fine for me.

It’s also in the code - the underlying jQuery plugin binds an onBlur event to hide the results. Does firebug throw any errors?

       
Mattias01's avatar
Mattias01
55 posts
16 years ago
Mattias01's avatar Mattias01

This is a great.

As it only has the ability to search titles does anyone know how to edit the plugin php so it can do this:

Live search returns no results. Instead of the default “No Result”, it returns:

“No result. Click here to use our advanced search page”

With the link going to a specified URL. i.e www.mysite.com/site/advanced_search/

thanks anyone

       
wecreateyou's avatar
wecreateyou
86 posts
16 years ago
wecreateyou's avatar wecreateyou

That’s a great idea!

       
judin's avatar
judin
54 posts
15 years ago
judin's avatar judin

Although I kind of know how, could someone post simple instructions on modifying the code to pull in a further weblog field, from the same weblog.

Thanks

       
Nico Smit's avatar
Nico Smit
48 posts
15 years ago
Nico Smit's avatar Nico Smit

I couldn’t use

$('#keywords').livesearch('{site_url}search/livesearch/11/');

to search a specific section. Maybe it’s better to alter the following code in pi.live_search.php at line 54:

change:

$search_phrase =& $IN->QSTR;

in:

$search_phrase = (! isset($IN->SEGS[sizeof($IN->SEGS)])) ? '' : $IN->SEGS[sizeof($IN->SEGS)];

In this case, the plugin always searches the last segment.

Just my 2 cents..

       
shinka's avatar
shinka
138 posts
15 years ago
shinka's avatar shinka

Thanks for the code dj-rowan, but I’m not getting it to work on my Structure install. My links are in this format: /index.php/site/index/wedding-packages instead of: /weddings/wedding-packages

Any ideas?

       
shinka's avatar
shinka
138 posts
15 years ago
shinka's avatar shinka

Actually, I managed to fix that problem. However, now that I have the URLs working for my Structure pages, the links for my ‘standard’ weblogs don’t work, the ones with no page URLs. This is my code right now:

global $PREFS; 

        $site_pages = $PREFS->ini('site_pages');

        $data = '[';
        foreach($query->result as $row) 
        {
            if (false !== $site_pages 
                && isset($site_pages['uris'])
                && isset($site_pages['uris'][$row['entry_id']])
                )                
            {
                $path = $site_pages['uris'][$row['entry_id']];
            }
            else{
                $path = $row[$link_to];                
            }
                    
            $data .= '{ "title" : "'.$row['title'].'", "path" : "'.$path.'" }, ';            
            
        }
        
        // Take off the last comma
        $data = substr($data, 0, -2);
        $data .= ']';
        
        echo $data;
        exit;
       
NKT com's avatar
NKT com
124 posts
15 years ago
NKT com's avatar NKT com

Sorry if this has already been answered but how to i limit the search to particular sections?

       
Jordan Moore's avatar
Jordan Moore
45 posts
15 years ago
Jordan Moore's avatar Jordan Moore
Sorry if this has already been answered but how to i limit the search to particular sections?

I have the same question except I want to exclude one section.

Great plugin by the way!

  • Jordan
       
Pascal Kriete's avatar
Pascal Kriete
2,589 posts
15 years ago
Pascal Kriete's avatar Pascal Kriete

This post describes how to limit it to a particular weblog. Doing the opposite is a little more complicated, but it’ll still be something along those lines.

       
Matt Stein's avatar
Matt Stein
110 posts
15 years ago
Matt Stein's avatar Matt Stein

Has anybody had trouble getting this to work in IE6? I’ve tested in Safari, Firefox, Chrome, IE7, and IE8 with no problem, but for some reason I keep getting an ‘invalid character’ error in IE6 only. I’ve tried jQuery 1.2.6, 1.3.2, 1.4.1, and 1.4.2 to no avail.

       
Matt Stein's avatar
Matt Stein
110 posts
15 years ago
Matt Stein's avatar Matt Stein

Nevermind, IE6 wasn’t cool with gzipped JSON results. For posterity: if your livesearch.js implementation is giving you “invalid character” or other not-so-helpful errors in IE6 only, examine your page headers. I set up a test on a different server which worked, and finally got down to GZIP being the problem.

Thanks again, IE6.

       
First 3 4 5

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.