View Full Version : Shorter Decription
10-25-2003, 07:23 AM
I was trying to make shorter descriptions, but no succes.
I would like It to be like 150 characters, I tried to put that value in config, but it still creates larger descriptions.
In other words, I have desriptions like 4 lines of text, and I would like to have only 2 lines of text.
And another thing; I does something like that:
...part of the texton site ... ...bla bla bla... ...sdf gsdgsdg dsgdsg...
Does it show a context of the keyword?
Well, my wish is to be not longer ( whole description) than 150-160 characters.
10-25-2003, 08:03 AM
Hi. Try changing define('DISPLAY_SNIPPETS_NUM',4); to define('DISPLAY_SNIPPETS_NUM',2); in the config file. This shold make it so that there are a max of two ... keyword in here ... ... keyword also in here ... displayed in the results.
10-25-2003, 08:20 AM
huh, Idid that just now, but :
those snippets are not more than 2 , but they are too long (180 characters),
if there are 2 snippets in one description, it makes 360 charecters.
and what I want is something about 160-180 caracters for whole descriptions, so if I set 2 snippets, they got to be not larger than 90-100 characters.
Somethings wrong with it: I will post 2 lines of my config:
define('SUMMARY_DISPLAY_LENGTH',190); //Max chars displayed in description
define('DISPLAY_SNIPPETS_NUM',2); //Max snippets to display
and if still displays more than I wish.
I even tryied to crawl again after changing config values. No luck.
Huh help please.
10-25-2003, 08:45 AM
Hi. Oh, I see. Try setting DISPLAY_SUMMARY to true and DISPLAY_SNIPPETS to false and SUMMARY_DISPLAY_LENGTH to 160.
10-25-2003, 09:05 AM
oki i did that, but it doesn't show description at all, then ??
10-25-2003, 09:14 AM
Well thats becouse some pages doesn't have descriptions in meta, so best way is to reduce numer of words in snippets?
Do You know how to do that??
10-25-2003, 12:37 PM
Hi. The DISPLAY_SUMMARY starts at the beginning and goes to SUMMARY_DISPLAY_LENGTH whereas the DISPLAY_SNIPPETS is per line and displays DISPLAY_SNIPPETS_NUM snippets.
To get SUMMARY_DISPLAY_LENGTH to work with DISPLAY_SNIPPETS_NUM try the following.
In the libs directory, open search_function.php and find the following:
and right afterwards put the following:
$match_this_spot = str_replace('<','<',str_replace('>','>',trim($match_this_spot)));
$match_this_spot = eregi_replace($reg_strings,"\\\\1<\\\\2>\\\\3",$extract_content);
$first_bold_spot = strpos($match_this_spot,"<");
$first_bold_spot = max($first_bold_spot - round((SUMMARY_DISPLAY_LENGTH / 2),0), 0);
$extract_content = substr($extract_content,$first_bold_spot,max(SUMMARY_DISPLAY_LENGTH, 2 * strlen($query_string)));
Now set DISPLAY_SUMMARY to false, DISPLAY_SNIPPETS to true, DISPLAY_SNIPPETS_NUM to X snippets, and SUMMARY_DISPLAY_LENGTH to Y characters so that X times Y equals 160.
Also, the length of the text displayed between the dots is dependent on the length of that line in the respective file in the text_content directory.
That means that if the length of the line equals Z characters, which is less than Y characters, then only Z characters will be displayed between the dots.
Remember to remove any "word" wrapping in the above code. ;)
10-26-2003, 04:24 AM
welll I got blank page with errors:
Parse error: parse error in phpdig/libs/search_function.php on line 302
Fatal error: Call to undefined function: phpdigsearch() in /public_html/search.php on line 47
10-26-2003, 06:45 AM
Hi. The above code is currently working in the demo. Maybe a typo was introduced somewhere during the copy-paste?
vBulletin® v3.7.3, Copyright ©2000-2015, Jelsoft Enterprises Ltd.