https://bugzilla.wikimedia.org/show_bug.cgi?id=30377

       Web browser: ---
             Bug #: 30377
           Summary: Suggestion to add a new parameter to limit the number
                    of characters when rendereing the channel item
                    <description>
           Product: MediaWiki extensions
           Version: any
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Unprioritized
         Component: RSS
        AssignedTo: wikibugs-l@lists.wikimedia.org
        ReportedBy: m...@tgries.de
                CC: brightb...@gmail.com, jeroen_ded...@yahoo.com,
                    m...@everybody.org
    Classification: Unclassified


We need to introduce an optional parameter, and a default value to limit the
number of characters. An implementation idea has been posted in 2010 on
http://www.mediawiki.org/wiki/Extension_talk:RSS#How_to_modify_the_length_of_the_description.3F
and is partially copied here:

How to modify the length of the description?

    Something like this:

preg_replace('/^(.{150}).{3,}(.{25})$/us', '$1 ... $2', $item['description']);

    Play around with the numbers and you'll see. --Subfader 21:48, 5 March 2010
(UTC)

            I changed rss.php a lot so I didn't check it, but it should work
like this: Replace

if ( $item['description'] ) {
$text = trim( iconv( $charset, $wgOutputEncoding, $item['description'] ) );

with

if ( $item['description'] ) {
$shortdesc = preg_replace('/^(.{150}).{3,}(.{25})$/us', '$1 ... $2',
$item['description']);
$text = trim( iconv( $charset, $wgOutputEncoding, $shortdesc ) );

This will shorten the description text to [150 chars ... 25 chars]. --Subfader
19:15, 16 March 2010 (UTC)

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to