Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
vBindex: Use a [BBTag] to control news text trimming Details »»
vBindex: Use a [BBTag] to control news text trimming
Version: 1.00, by Telkman Telkman is offline
Developer Last Online: Sep 2011 Show Printable Version Email this Page

Version: 3.0.7 Rating:
Released: 03-17-2005 Last Update: Never Installs: 1
 
No support by the author.

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:
PHP Code:
          // ## 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(fetch_trimmed_title($news['pagetext'], $vbindex['newscharlimit']), truetrue), $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:
PHP Code:
          // ## CENSOR NEWS AND PARSE vB CODE ##
        
$cnewstext explode('[snip]',$news['pagetext']);
          if (
$cnewstext[1])  {
                
$news['pagetext'] = fetch_censored_text(strip_bbcode(parse_bbcode($cnewstext[0], truetrue), $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. [snip][/snip]). 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: [snip]text[/snip]
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 [snip] 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[/snip] is used or nothing when [snip][/snip] is used.

It would be very simple to have [snip]snippet text[/snip] 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.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 03-19-2005, 03:20 AM
ragintajin ragintajin is offline
 
Join Date: Sep 2003
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

excellent, i've been waiting for something like this.
Reply With Quote
  #3  
Old 03-19-2005, 04:02 PM
T3MEDIA T3MEDIA is offline
 
Join Date: Dec 2004
Posts: 944
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey if you worked on vbindex did you ever find out why the tables go out of shape in mozillia browsers? firefox allways has the site in a way you have to scroll to see the far right colums.

If you know PLEASE let me know. That would be awsome since my site looks horrable viewed in firefox
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:44 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03806 seconds
  • Memory Usage 2,224KB
  • Queries Executed 16 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (2)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete