Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
[previewbreak] for blog posts Details »
[previewbreak] for blog posts
Mod Version: 1.00, by xorlof (Coder) xorlof is offline
Developer Last Online: Feb 2020 I like it Show Printable Version Email this Page

vB Version: 4.2.2 Rating: (0 vote - 0 average) Installs: 5
Released: 04 Feb 2015 Last Update: Never Downloads: 0
Not Supported Code Changes Re-usable Code  

This is my first attempt at making something for VB4, so be kind. Tips/tricks on how I could have done this better are most welcome...

The CMS has the code [prbreak] which allows you to specify exactly where you want the shortened version of an article to stop, after which you can hit the "read more" link to see the rest. The blog system doesn't have this functionality, so I hacked it in. There are two steps needed to make this work:

STEP ONE: CREATE A [PREVIEWBREAK] BB CODE
a) Goto Admin CP -> Custom BB Code -> BB Code Manager -> Add New BB Code
b) Fill out the form as follows:
Title: Preview Break (blog only)
Tag name: previewbreak
Replacement: <!-- preview break -->
Example: [previewbreak][/previewbreak]
Description: Include an empty [previewbreak] tag ( [previewbreak][/previewbreak] ) to force a blog preview to end at that point instead of after a certain number of characters (the default behavior).
STEP TWO: EDIT THE BLOG BBCODE PARSER
Sorry--I couldn't figure out a way to do this without editing source code. Anyway, we have to edit class_bbcode_blog.php (from the vBulletin "includes" directory) in three places:

Edit #1: Find:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

and on new lines after the closing curly brace add this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Edit #2: Repeat edit #1 in the other spot the find text occurs in the same file.

Edit #3: Find:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

and on new lines after that opening curly brace add this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

That's it! Now you can insert [previewbreak][/previewbreak] anywhere within your blog post to force the break at that spot. It even works if the forced spot occurs after the regular (non-forced) break would occur (i.e., you can lengthen a preview using this code).

And with a little bit of reworking, it would be pretty straightforward to allow you to put text between the opening and closing previewbreak tags that is only shown on the preview page (e.g., "[previewbreak]Read on to find out why [subject of blog post] is so great.[/previewbreak]"). Since I doubt this will be a popular mod (I'll consider 2 installs, including me to be a huge success), and I have no use for that, I'll leave that to someone else.

Download Now

Only licensed members can download files, Click Here for more information.

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Similar Mod
Mod Developer Type Replies Last Post
Add-On Releases dmActivityStream - Blog Posts and Blog Comments Lairston vBulletin 4.x Add-ons 5 10 Feb 2012 05:45

Comments
  #2  
Old 04 Feb 2015, 19:00
xorlof xorlof is offline
 
Join Date: Sep 2012
Reserved.

(Not that I think I'll need this spot, but it's what all the cool kids around here do!)
Reply With Quote
  #3  
Old 07 Feb 2015, 09:33
xorlof xorlof is offline
 
Join Date: Sep 2012
Woo Hoo! My first (not me) install! I don't know who you are, but let me know if you have questions/problems. (While I have this marked as unsupported, I'm happy to answer questions/troubleshoot as I can. I just don't want to promise support).
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Mod Options

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


New To Site? Need Help?

All times are GMT. The time now is 10:48.

Layout Options | Width: Wide Color: