Welcome to Geeklog, Anonymous Saturday, August 31 2024 @ 10:57 pm EDT
Geeklog Forums
To create a words length limit
Status: offline
OMAL
Forum User
Regular Poster
Registered: 12/06/17
Posts: 107
I would like to limit the length of intro text, if possible (and I know it's possible but it would be quite complicated in case of customization).
If anyone know the way or plugins doing like that, let me know.
The important point is that how to deal with the html source between tags or inside a tag. For instance, when the break point is <img src="ho (here would be the break point) ge" alt ="hoge">, image is not displayed.
Thanks.
If anyone know the way or plugins doing like that, let me know.
The important point is that how to deal with the html source between tags or inside a tag. For instance, when the break point is <img src="ho (here would be the break point) ge" alt ="hoge">, image is not displayed.
Thanks.
9
8
Quote
Status: offline
Laugh
Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
What was your solution?
There are no plugins that allow limiting of the article editor intro section. That would have to be built into the article editor itself.
The other option is to use the advanced editor and then force it to limit the characters:
https://stackoverflow.com/questions/34473418/ckeditor-limit-characters-on-more-editors-in-one-page
This would require some changes with Geeklog itself as well since you would only want this to happen for the intro area.
For a different solution you could also look at COM_truncateHTML which we use to truncate rss feeds in Geeklog. It will remove mangled html tags and add any missing close tags. Of course to use something like this the article editor would have to be customized.
One of the Geeklog Core Developers.
There are no plugins that allow limiting of the article editor intro section. That would have to be built into the article editor itself.
The other option is to use the advanced editor and then force it to limit the characters:
https://stackoverflow.com/questions/34473418/ckeditor-limit-characters-on-more-editors-in-one-page
This would require some changes with Geeklog itself as well since you would only want this to happen for the intro area.
For a different solution you could also look at COM_truncateHTML which we use to truncate rss feeds in Geeklog. It will remove mangled html tags and add any missing close tags. Of course to use something like this the article editor would have to be customized.
One of the Geeklog Core Developers.
23
12
Quote
Status: offline
OMAL
Forum User
Regular Poster
Registered: 12/06/17
Posts: 107
What was your solution?
I just added the following lines before DB_save in the story.php.
Text Formatted Code
$word_length= 470;$strlen_bf = mb_strlen($introtext,'utf-8');
$introtext = mb_strimlen($introtext,0,$word_length,"...",'utf-8');
$strlen_af = mb_strlen($introtext,'utf-8');
if($strlen_bf <> $strlen_af){
$display .= COM_siteHeader('menu', $LANG24[5]);
$display .= COM_errorLog('Your intro text is too long to submit.', 2);
$display .= storyeditor($sid);
$display .= COM_siteFooter();
echo $display;
exit;
}
You could define the word_length as $_CONF['word_length'] in custom config.file.
14
10
Quote
All times are EDT. The time is now 10:57 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