PhpDig.net

Go Back   PhpDig.net > PhpDig Forums > How-to Forum

Reply
 
Thread Tools
Old 10-25-2003, 08:23 AM   #1
plodz
Green Mole
 
Join Date: Oct 2003
Posts: 8
Shorter Decription

Hi there.
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.

Please Help
Paul
plodz is offline   Reply With Quote
Old 10-25-2003, 09:03 AM   #2
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
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.
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote
Old 10-25-2003, 09:20 AM   #3
plodz
Green Mole
 
Join Date: Oct 2003
Posts: 8
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.
THX
Plodz1
plodz is offline   Reply With Quote
Old 10-25-2003, 09:45 AM   #4
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Hi. Oh, I see. Try setting DISPLAY_SUMMARY to true and DISPLAY_SNIPPETS to false and SUMMARY_DISPLAY_LENGTH to 160.
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote
Old 10-25-2003, 10:05 AM   #5
plodz
Green Mole
 
Join Date: Oct 2003
Posts: 8
oki i did that, but it doesn't show description at all, then ??

Plodz1
plodz is offline   Reply With Quote
Old 10-25-2003, 10:14 AM   #6
plodz
Green Mole
 
Join Date: Oct 2003
Posts: 8
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??

THX
Paul
plodz is offline   Reply With Quote
Old 10-25-2003, 01:37 PM   #7
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
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:
PHP Code:
if(eregi($reg_strings,$extract_content)) { 
and right afterwards put the following:
PHP Code:
$match_this_spot str_replace('<','&lt;',str_replace('>','&gt;',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_LENGTHstrlen($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.
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote
Old 10-26-2003, 05:24 AM   #8
plodz
Green Mole
 
Join Date: Oct 2003
Posts: 8
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

thx anyway
Plodz1
plodz is offline   Reply With Quote
Old 10-26-2003, 07:45 AM   #9
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Hi. The above code is currently working in the demo. Maybe a typo was introduced somewhere during the copy-paste?
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote
Reply


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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to show shorter titles in results? orbitalz Troubleshooting 1 05-01-2004 07:18 AM


All times are GMT -8. The time now is 09:31 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.