Benchmark Reviews Discussion Forum Right Header

Go Back Benchmark Reviews Discussion Forum > Software > Web Design & Development

Web Design & Development Discussion ranging from HTML to SEO, PHP to XML, and everything else inbetween.

Reply
Thread Tools Display Modes
#1
Unread 26th February 2008, 09:31 AM
Olin Coles's Avatar
Olin Coles Olin Coles is offline
Executive Editor
Join Date: Feb 2007
Posts: 2,951
Change Joomla Search Word Limit

I recently tried to find information on how to easily change the searchword limit in Joomla, beyond the default value of 20 and found nothing of the sort in terms of a guide. So here's how I did it for Joomla version 1.0.15.

You will need to begin by setting the maximum number of characters you want the search box to display. This variable is set in the Modules - Site Modules - Search edit menu. Keep your characters inside the search box, or else you'll have long searches moving the entire site over.

Next, use a strong text editor or html editor to change variables in several key Joomla files. Some of these files may not be relevant to your change, but they all reference the searchword limit, so it's best to be thorough. Here are the steps to take if you want to change the searchword limit from 20 to 40 as an example:
  1. components/com_search/search.html.php
    • Change: maxlength="20"
    • Into: maxlength="40"
  2. components/com_search/search.html.php
    • Change: if ( strlen( $searchword ) > 20 ) {
    • Into: if ( strlen( $searchword ) > 40 ) {
  3. modules/mod_search.php
    • Change: $width = intval( $params->get( 'width', 20 ) );
    • Into: $width = intval( $params->get( 'width', 40 ) );
That's it! Once you have made these changes, your search word box will now use the specified number of characters in the performance of a search. But with all of the extra power, you might consider one last change.

To change the default value of the Joomla Search function from "Any Words" into "All Words", add the following line of code into components/com_search/search.php.

Below: $mainframe->setPageTitle( _SEARCH_TITLE );
Add: if($_REQUEST['searchphrase']=='') { $_REQUEST['searchphrase']=$_GET['searchphrase']='all'; }

Please post here if this was helpful to you, or there are any questions.
__________________
You can follow Benchmark Reviews on Facebook and Twitter!
Reply With Quote
#2
Unread 10th March 2008, 02:21 PM
blucadet3 blucadet3 is offline
Bit
Join Date: Mar 2008
Posts: 2
Any ideas about 1.5?

Do you know how to do this in Joomla 1.5?

Thanks.
Reply With Quote
#3
Unread 10th March 2008, 02:54 PM
Olin Coles's Avatar
Olin Coles Olin Coles is offline
Executive Editor
Join Date: Feb 2007
Posts: 2,951
It's my understanding that this problem still exists in Joomla v1.51 (current version), and they are working on a fix for future versions. You might also try the instruction above to see if it has any effect.
__________________
You can follow Benchmark Reviews on Facebook and Twitter!
Reply With Quote
#4
Unread 12th March 2008, 06:54 AM
blucadet3 blucadet3 is offline
Bit
Join Date: Mar 2008
Posts: 2
I did try. Thanks for your reply.

The code is the same, the file is default_form.php instead of search.html.php...

I made the changes, and I can enter more characters in the search box, but when I execute the search its still cut off. There must be another line of code in another file somewhere.

Thanks again.
Reply With Quote
Sponsored links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Search Engine Optimization And Search Engine Crawlers Olin Coles Web Design & Development 1 9th September 2009 01:25 AM
Joomla 1.5 Pagebreak Inserts at Top: Solved Olin Coles Web Design & Development 1 4th May 2009 02:04 PM
Copy Joomla content title to meta description and keywords Olin Coles Web Design & Development 0 29th December 2008 10:33 AM
Joomla JCE Insert Image Error Solved Olin Coles Web Design & Development 0 24th November 2008 10:36 PM


All times are GMT -7. The time now is 10:22 PM.

Benchmark Reviews Discussion Forum
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Remove advertisements

Follow Benchmark Reviews on FacebookReceive Tweets from Benchmark Reviews on Twitter