Telkman
03-17-2005, 10:00 PM
I've ripped the code for vBindex to shreds in adding extra functionality to it... probably the sort of things that would have been added were it still in development.
Most are fairly specific to my board it is installed on, but one thing that I thought other people may benefit from is a small code modification to vbindex.php that allows you to control how large the snippet of news is that is displayed in the newsbit.
Find this code in vbindex.php: // ## CENSOR NEWS AND PARSE vB CODE ##
if (!empty($vbindex['newscharlimit']) && (vbstrlen(strip_bbcode($news['pagetext'])) > $vbindex['newscharlimit'])) {
$news['pagetext'] = fetch_censored_text(strip_bbcode(parse_bbcode(fetc h_trimmed_title($news['pagetext'], $vbindex['newscharlimit']), true, true), $news['forumid'], 1));
$show['readmore'] = true;
} else {
$news['pagetext'] = fetch_censored_text(parse_bbcode($news['pagetext'], $news['forumid'], 1));
$show['readmore'] = false;
}
and replace it with: // ## CENSOR NEWS AND PARSE vB CODE ##
$cnewstext = explode('[snip]',$news['pagetext']);
if ($cnewstext[1]) {
$news['pagetext'] = fetch_censored_text(strip_bbcode(parse_bbcode($cne wstext[0], true, true), $news['forumid'], 1));
$show['readmore'] = true;
} else {
$news['pagetext'] = fetch_censored_text(parse_bbcode($news['pagetext'], $news['forumid'], 1));
$show['readmore'] = false;
}
Then go to AdminCP > Custom BB Codes > Add New BB Code
As you can't create [shorttags] we'll have to use a [normal][/pair] but this has it's advantages. Because the BBCode is parsed after the check for the tag within the modified vbindex.php, you can leave the tags empty in your post (e.g. ). This will still snip the code in the news post, but will make no change to your regular forum post, as it will be removed and ignored.
Input the details as so and click Save.
Title: End News Snippet
Tag: snip
Replacement: <div style="border-bottom:#999999 1px dashed; margin:15px 30px;"></div>
Example: text
Description: Indicates the end of the news snippet used within vBindex.
If you change the [tag] used you will also need to replace the one occurence of in the modified php code with the tag you choose to use. The title, example and description you can edit as you see fit.
This particular example will display a dashed border in the normal thread display when [snip]any text is used or nothing when is used.
It would be very simple to have snippet text displayed for the news and then hidden in the normal thread display, or even [snip=show]/[snip=hide] to choose. I haven't included this functionality as I didn't want to over complicate things, but if people would like to see that I'll put up an example.
Most are fairly specific to my board it is installed on, but one thing that I thought other people may benefit from is a small code modification to vbindex.php that allows you to control how large the snippet of news is that is displayed in the newsbit.
Find this code in vbindex.php: // ## CENSOR NEWS AND PARSE vB CODE ##
if (!empty($vbindex['newscharlimit']) && (vbstrlen(strip_bbcode($news['pagetext'])) > $vbindex['newscharlimit'])) {
$news['pagetext'] = fetch_censored_text(strip_bbcode(parse_bbcode(fetc h_trimmed_title($news['pagetext'], $vbindex['newscharlimit']), true, true), $news['forumid'], 1));
$show['readmore'] = true;
} else {
$news['pagetext'] = fetch_censored_text(parse_bbcode($news['pagetext'], $news['forumid'], 1));
$show['readmore'] = false;
}
and replace it with: // ## CENSOR NEWS AND PARSE vB CODE ##
$cnewstext = explode('[snip]',$news['pagetext']);
if ($cnewstext[1]) {
$news['pagetext'] = fetch_censored_text(strip_bbcode(parse_bbcode($cne wstext[0], true, true), $news['forumid'], 1));
$show['readmore'] = true;
} else {
$news['pagetext'] = fetch_censored_text(parse_bbcode($news['pagetext'], $news['forumid'], 1));
$show['readmore'] = false;
}
Then go to AdminCP > Custom BB Codes > Add New BB Code
As you can't create [shorttags] we'll have to use a [normal][/pair] but this has it's advantages. Because the BBCode is parsed after the check for the tag within the modified vbindex.php, you can leave the tags empty in your post (e.g. ). This will still snip the code in the news post, but will make no change to your regular forum post, as it will be removed and ignored.
Input the details as so and click Save.
Title: End News Snippet
Tag: snip
Replacement: <div style="border-bottom:#999999 1px dashed; margin:15px 30px;"></div>
Example: text
Description: Indicates the end of the news snippet used within vBindex.
If you change the [tag] used you will also need to replace the one occurence of in the modified php code with the tag you choose to use. The title, example and description you can edit as you see fit.
This particular example will display a dashed border in the normal thread display when [snip]any text is used or nothing when is used.
It would be very simple to have snippet text displayed for the news and then hidden in the normal thread display, or even [snip=show]/[snip=hide] to choose. I haven't included this functionality as I didn't want to over complicate things, but if people would like to see that I'll put up an example.