Welcome to Geeklog, Anonymous Monday, April 13 2026 @ 12:42 am EDT
Geeklog Forums
Simple lib-story.php hack for "read more"
Yeraze
Anonymous
I've noticed that since I started using the new fckEditor stuff, every story I write winds up with "read more (1 words)", and I can't seem to get rid of whatever little character it writes.
A simple hack around line 289 of lib-story.php to compute numwords and then compare that fixes it.
if( !empty( $bodytext ))
{
$numwords = COM_NumberFormat (sizeof( explode( ' ', strip_tags( $bodytext ))));
if ($numwords > 1) {
$article->set_var( 'lang_readmore', $LANG01[2] );
$article->set_var( 'lang_readmore_words', $LANG01[62] );
$article->set_var( 'readmore_words', $numwords );
$article->set_var( 'readmore_link', '<a href="' . $articleUrl . '">'
. $LANG01[2] . '</a> (' . $numwords . ' ' . $LANG01[62]
. ') ' );
$article->set_var( 'start_readmore_anchortag', '<a href="'
. $articleUrl . '">' );
$article->set_var( 'end_readmore_anchortag', '</a>' );
}
}
Odds of getting this into standard release ?
A simple hack around line 289 of lib-story.php to compute numwords and then compare that fixes it.
Text Formatted Code
if( !empty( $bodytext ))
{
$numwords = COM_NumberFormat (sizeof( explode( ' ', strip_tags( $bodytext ))));
if ($numwords > 1) {
$article->set_var( 'lang_readmore', $LANG01[2] );
$article->set_var( 'lang_readmore_words', $LANG01[62] );
$article->set_var( 'readmore_words', $numwords );
$article->set_var( 'readmore_link', '<a href="' . $articleUrl . '">'
. $LANG01[2] . '</a> (' . $numwords . ' ' . $LANG01[62]
. ') ' );
$article->set_var( 'start_readmore_anchortag', '<a href="'
. $articleUrl . '">' );
$article->set_var( 'end_readmore_anchortag', '</a>' );
}
}
Odds of getting this into standard release ?
27
33
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by Yeraze: Odds of getting this into standard release ?
I'd rather see a fix for the actual issue itself. It's only happening when the advanced story editor is active.
A "better" hack (if there is such a thing as a better hack ...) would be to check if the story's body text contains only a BR (I think it was a BR tag causing this) and silently stripping it before saving the story.
bye, Dirk
27
23
Quote
Yeraze
Anonymous
I agree 100%, but that's a little beyond my current comprehension of the codebase
27
25
Quote
Uwe
Anonymous
I'v added:
$bodytext = '';
}
in story.php before DB_save and it works fine but I agree, it's not very elegant. Does anybody know where I can find the place where the editor-bodytext will initalized with the br-tag?
Text Formatted Code
if ($bodytext == '<br>') {$bodytext = '';
}
in story.php before DB_save and it works fine but I agree, it's not very elegant. Does anybody know where I can find the place where the editor-bodytext will initalized with the br-tag?
29
27
Quote
Status: offline
samstone
Forum User
Full Member
Registered: 09/29/02
Posts: 820
It is in the fckconfig.js. Change the following setting to true:
FCKConfig.IgnoreEmptyParagraphValue = true ;
And you will be happier with the FCKeditor if you upgrade it to 2.2. The one comes with GL 1.4 is 2.1.1.
Hope this helps.
Sam
FCKConfig.IgnoreEmptyParagraphValue = true ;
And you will be happier with the FCKeditor if you upgrade it to 2.2. The one comes with GL 1.4 is 2.1.1.
Hope this helps.
Sam
27
28
Quote
All times are EDT. The time is now 12:42 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content