StewardManscat
07-21-2004, 08:24 PM
I allow HTML in the news.
I used a table to display an image next to the copy.
Later, I decided I was too wordy, and I should take advantage of the "read more" option.
Oh my goodness... of course cmps only displays a partial table, and the remainder of the news page was destroyed, as the ending </td> tag did not make it into the news.
Okay, I can fiddle with that. But it strikes me as fiddling with fire. Too easy to break again later.
Just wondering if anyone else had encountered this and developed a good solution.
I think maybe CSS can do it, but it's been a long time for me... I vaguely recall reading that CSS positioning logic was not always dependable across browsers.
* * * Later that same day... * * *
Using a word count for cutoff is arbitrary, and strips the author of editorial control.
It is more important that lead items cut off at an intelligent point, rather than each item having the same length.
This would shoot the table problem, and put control squarely back in the hands of the editor.
I almost got excited about this, but fell down and bloodied my nose:
At the very end of parsebbcode2 (functions_bbcodeparse.php) I added:
global $newsItem;
if ($newItem)
$bbcode = str_replace('[ReadMore]', '', $bbcode);
In modules/news.php I replaced
$news['message'] = parse_bbcode2($news['pagetext'], $vba_options['portal_news_enablehtml'], $vba_options['portal_news_enablevbimage'], $allowsmilie, $vba_options['portal_news_enablevbcode']);
if ($vba_options['portal_news_maxchars'] AND strlen($news['message']) > $vba_options['portal_news_maxchars'])
{
$news['message'] = fetch_trimmed_title($news['message'], $vba_options['portal_news_maxchars']) . construct_phrase($vbphrase['read_more'], $vboptions['bburl'], $news['threadid'], $session['sessionurl']);
}
with:
// Signal bbparser NOT to strip the [ReadMore] tag
$newsItem=true;
// Parse the string normally, but leave my [ReadMore] in place
$news['message'] = parse_bbcode2($news['pagetext'], $vba_options['portal_news_enablehtml'], $vba_options['portal_news_enablevbimage'], $allowsmilie, $vba_options['portal_news_enablevbcode']);
$i=strpos($news['message'], '[ReadMore]');
if ($i>0)
// Truncate the item
$news['message'] = substr($news['message'],0,$i) . construct_phrase($vbphrase['read_more'], $vboptions['bburl'], $news['threadid'], $session['sessionurl']);
... remembering to unset $newsItem at the end of the script.
Works ok, but using globals to control bbparse behaviour srtikes me as something no well-mannered coder would do. Having no manners at all, I can live with it. But I am betting there is a guru at this forum (ahem) who knows so much more about vb than me, he may suggest a safer, easier, well-lit, sanctioned and government-approved route to go.
Thank you for listening.
I used a table to display an image next to the copy.
Later, I decided I was too wordy, and I should take advantage of the "read more" option.
Oh my goodness... of course cmps only displays a partial table, and the remainder of the news page was destroyed, as the ending </td> tag did not make it into the news.
Okay, I can fiddle with that. But it strikes me as fiddling with fire. Too easy to break again later.
Just wondering if anyone else had encountered this and developed a good solution.
I think maybe CSS can do it, but it's been a long time for me... I vaguely recall reading that CSS positioning logic was not always dependable across browsers.
* * * Later that same day... * * *
Using a word count for cutoff is arbitrary, and strips the author of editorial control.
It is more important that lead items cut off at an intelligent point, rather than each item having the same length.
This would shoot the table problem, and put control squarely back in the hands of the editor.
I almost got excited about this, but fell down and bloodied my nose:
At the very end of parsebbcode2 (functions_bbcodeparse.php) I added:
global $newsItem;
if ($newItem)
$bbcode = str_replace('[ReadMore]', '', $bbcode);
In modules/news.php I replaced
$news['message'] = parse_bbcode2($news['pagetext'], $vba_options['portal_news_enablehtml'], $vba_options['portal_news_enablevbimage'], $allowsmilie, $vba_options['portal_news_enablevbcode']);
if ($vba_options['portal_news_maxchars'] AND strlen($news['message']) > $vba_options['portal_news_maxchars'])
{
$news['message'] = fetch_trimmed_title($news['message'], $vba_options['portal_news_maxchars']) . construct_phrase($vbphrase['read_more'], $vboptions['bburl'], $news['threadid'], $session['sessionurl']);
}
with:
// Signal bbparser NOT to strip the [ReadMore] tag
$newsItem=true;
// Parse the string normally, but leave my [ReadMore] in place
$news['message'] = parse_bbcode2($news['pagetext'], $vba_options['portal_news_enablehtml'], $vba_options['portal_news_enablevbimage'], $allowsmilie, $vba_options['portal_news_enablevbcode']);
$i=strpos($news['message'], '[ReadMore]');
if ($i>0)
// Truncate the item
$news['message'] = substr($news['message'],0,$i) . construct_phrase($vbphrase['read_more'], $vboptions['bburl'], $news['threadid'], $session['sessionurl']);
... remembering to unset $newsItem at the end of the script.
Works ok, but using globals to control bbparse behaviour srtikes me as something no well-mannered coder would do. Having no manners at all, I can live with it. But I am betting there is a guru at this forum (ahem) who knows so much more about vb than me, he may suggest a safer, easier, well-lit, sanctioned and government-approved route to go.
Thank you for listening.