e-steki
10-23-2005, 01:09 PM
I think it would be a useful feature to give the user (or only mods) the ability to choose which part of their article will be displayed as a preview :)
Brian
10-24-2005, 01:24 PM
I had a hack on my personal site a little while ago that may help you. I just had it set to where the user could use the tag [news] around the text they actually want shown in the news section. Just the text within the tags would be displayed in the news section, and it would not be displayed in the post itself. I'm not sure how well it would work now, but you can try adding a new BB code using the following options:
Title: News
Tag: news
Replacement: <b></b>
Everything else: Blank
Then look in your modules/news.php file for this code:
$news['message'] = $bbcode_parser->do_parse($news['pagetext'], $mod_options['portal_news_enablehtml'], $news['allowsmilie'], $mod_options['portal_news_enablevbcode'], $mod_options['portal_news_enablevbimage']);
if ($mod_options['portal_news_maxchars'] AND strlen($news['message']) > $mod_options['portal_news_maxchars'])
{
$news['message'] = substr($news['message'], 0, strrpos(substr($news['message'], 0, $mod_options['portal_news_maxchars']), ' ')) . '...' . construct_phrase($vbphrase['read_more'], $vbulletin->options['bburl'], $news['threadid'], $session['sessionurl']);
}
And replace with this:
// Check for the [news] Tag
if (eregi("\[news\]", $news['pagetext']))
{
preg_match("/(\[news\])(.*)(\[\/news\])/siU", $news['pagetext'], $newtext);
$news['message'] = $bbcode_parser->do_parse($newtext[2], $mod_options['portal_news_enablehtml'], $news['allowsmilie'], $mod_options['portal_news_enablevbcode'], $mod_options['portal_news_enablevbimage']);
$news['message'] = $news['message'] . '...' . construct_phrase($vbphrase['read_more'], $vbulletin->options['bburl'], $news['threadid'], $session['sessionurl']);
}
else
{
$news['message'] = $bbcode_parser->do_parse($news['pagetext'], $mod_options['portal_news_enablehtml'], $news['allowsmilie'], $mod_options['portal_news_enablevbcode'], $mod_options['portal_news_enablevbimage']);
if ($mod_options['portal_news_maxchars'] AND strlen($news['message']) > $mod_options['portal_news_maxchars'])
{
$news['message'] = substr($news['message'], 0, strrpos(substr($news['message'], 0, $mod_options['portal_news_maxchars']), ' ')) . '...' . construct_phrase($vbphrase['read_more'], $vbulletin->options['bburl'], $news['threadid'], $session['sessionurl']);
}
}
e-steki
10-24-2005, 01:50 PM
Thanks a lot for that!! Great idea. Why don't you include a similar feature in the next version?
Some questions before I apply:
I don't want it to be bold, what should I put?
If I have two paragraphs with news tag around them will it show both? What will it show?
I didn't understand something... The text within the news tag will be displayed in the article or not? I think it would be ideal to be displayed in it cause most of the times you want images in the article and the preview and it's not good for bandwidth to have them twice...
Brian
10-24-2005, 01:55 PM
Nothing will be bold, that just replaces the text within the news tag with <b></b> to hide it.
There wouldn't be any reason to have two... Start off the post with Preview text here, and then go on with the post. The text within the news tag will not be shown on your posts, but only in the news.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.