Welcome to Geeklog Thursday, June 20 2019 @ 07:12 pm 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.
PHP 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 ?

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/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

Yeraze

Anonymous
hopeful
I agree 100%, but that's a little beyond my current comprehension of the codebase

Uwe

Anonymous
I'v added:
PHP 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?

Status: offline

samstone

Forum User
Full Member
Registered: 29/09/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

All times are EDT. The time is now 07:12 pm.

  • 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