WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.9 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Searchbox with suggestions
  • Print
Pages: 1 [2]   Go Down

Author Topic: Searchbox with suggestions  (Read 37904 times)

Offline VSG

  • Posts: 278
Re: Searchbox with suggestions
« Reply #25 on: May 03, 2010, 08:24:25 PM »
Thanks, that did the trick!

Now I just have to customize it to blend it in with the website as my standard-search ... :)
Great idea!

Thanks again and best regards,
VSG
Logged

Offline VSG

  • Posts: 278
Re: Searchbox with suggestions
« Reply #26 on: May 03, 2010, 08:52:56 PM »
One more question: is there a way to define a color for your suggestions? I can't seem to find it. Was able to define most of the colors though ...

Thanks in advance for any tip!
Best regards,
VSG
Logged

Offline crnogorac081

  • Posts: 2168
  • Gender: Male
Re: Searchbox with suggestions
« Reply #27 on: May 03, 2010, 08:58:55 PM »
Hi,

the links use your standard link color from your css. If you want other color, you will have to style .suggestionList class

cheers
Logged
Web developer

Offline nuke

  • Posts: 31
Re: Searchbox with suggestions
« Reply #28 on: July 25, 2011, 11:08:23 PM »
Very cool - is there any way to limit the suggestions to a certain sub dir:
e.g. for my multilingual site I use the search_path value as /en/ to limit the search to just my English section, and do the same with my Spanish /es/ etc

(More info here:
https://forum.WebsiteBaker.org/index.php/topic,10058.msg59052.html#msg59052 )

How would I go about limiting the suggestions in a similar fashion? Thanks in advance,

-Michael
Logged

Offline crnogorac081

  • Posts: 2168
  • Gender: Male
Re: Searchbox with suggestions
« Reply #29 on: July 26, 2011, 11:13:05 PM »
Hi,

try to replace
Code: [Select]
$query = $database->query("SELECT * FROM `".TABLE_PREFIX."pages` WHERE `page_title` LIKE '%$queryString%' LIMIT 20");
WITH
$query = $database->query("SELECT * FROM `".TABLE_PREFIX."pages` WHERE `language` = '".LANGUAGE."' `page_title` LIKE '%$queryString%' LIMIT 20");

in php file..
cheers
Logged
Web developer

Offline nuke

  • Posts: 31
Re: Searchbox with suggestions
« Reply #30 on: July 27, 2011, 05:15:24 PM »
Thanks for your prompt response crnogorac081. Apologies in advance, I'm probably missing something obvious, but I can't seem to get that code to work.

I tried replacing the line you mentioned with the following:
Code: [Select]
$query = $database->query("SELECT * FROM `".TABLE_PREFIX."pages` WHERE `language` = '".LANGUAGE."' `page_title` LIKE '%$queryString%' LIMIT 20");
And it didn't work, so I thought maybe I have to specify the language, so I tried:
Code: [Select]
$query = $database->query("SELECT * FROM `".TABLE_PREFIX."pages` WHERE `FR` = '".LANGUAGE."' `page_title` LIKE '%$queryString%' LIMIT 20");
then tried:
Code: [Select]
$query = $database->query("SELECT * FROM `".TABLE_PREFIX."pages` WHERE `language` = '"FR"' `page_title` LIKE '%$queryString%' LIMIT 20");
then:
Code: [Select]
$query = $database->query("SELECT * FROM `".TABLE_PREFIX."pages` WHERE `language` = '".FR."' `page_title` LIKE '%$queryString%' LIMIT 20");
As you can tell I'm not a programmer =/, can you provide some assistance?

So I'm assuming there is no way to limit the suggestions based on the sub directory? I'll have to go through my multi-lang site and make sure each page has the correct specified language (in the meantime I've set a few sections to French... I have a fairly large site and was hoping there would be another way)

Thanks,
-Mike
Logged

Offline crnogorac081

  • Posts: 2168
  • Gender: Male
Re: Searchbox with suggestions
« Reply #31 on: July 28, 2011, 05:17:34 PM »
Hi, create me a temp admin account and send me to PM, I will take a look
Logged
Web developer

Offline crnogorac081

  • Posts: 2168
  • Gender: Male
Re: Searchbox with suggestions
« Reply #32 on: September 23, 2011, 12:08:52 AM »
Hi,

I have this code in /search/search_convert.php to show special chars in local language in standard search, and it works ok.
Code: [Select]
$t["š"] = array("š", "s");
$t["s"] = array("š", "s");
$t["đ"] = array("đ", "dj");
$t["dj"] = array("đ", "dj");
$t["č"] = array("č", "c");
$t["c"] = array("č", "ć");
$t["ć"] = array("c", "ć");
$t["ž"] = array("ž", "z");
$t["z"] = array("ž", "z");

In search suggestion SQL I have this code which works ok :
Code: [Select]
$database->query("SELECT * FROM `".TABLE_PREFIX."pages` WHERE `page_title` LIKE '%$queryString%' LIMIT 20");

What I need is help to combine these two..could someone give me a hint or help ?

for example it title is: my name is saša , if I type both sasa or saša to work.

cheers,
Ivan
Logged
Web developer

  • Print
Pages: 1 [2]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Searchbox with suggestions
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2