![]() |
vBadvanced CMPS - News Digest Module 1.02
This header message last editted October 10th.
News Digest for vBadvanced CMPS vers. 1.0.2 This hack allows your vBadvanced hompage to display news in a digest format. Instead of having each article appear in a box, it will appear as an item in a bulleted list. These lists are sorted by date and then by category. If you're site has more than a couple of news items per day you should find this hack useful, especially if those news items are particularly small by themselves (only a line or two of text). Live examples: http://www.enworld.org/forums/index.php (starting below the ad for Dundjinni). This hack requires that you have vBadvanced CMPS of course. Image support for the categories (as seen on the enworld site) can be accomplished by installing BeerMonster's banner images on forumhome hack. If you don't want to install this other hack, or if you're boards has a different hack that associates images with forums, you'll need to modify the provided newsdigest.php file. BeerMonster's hack is found here... https://vborg.vbsupport.ru/showthread.php?t=63994 During the installation of this hack you will create 3 templates. This hack requires no file modifications in and of itself, but some supplemental hacks do require such modifications, and they'll be dealt with in detail shortly. First, the primary hack: Step 1: Prepare the newsdigest.php file. Download the attached file and put it in [yourforum]/modules/ Step 1A: If you don't want to have any forum images for your categories, or don't wish to install the forum banners hack above then open the newsdigest.php file and search for the following code. Find: PHP Code:
PHP Code:
Step 2: Create the Templates Create a new template called adv_portal_newsdigest_date and insert the following into it: HTML Code:
<if condition="$prevdate"><br /><hr></if> HTML Code:
<b>$news[title]</b><if condition="$news['icon']"><img src="./images/forumicons/$news[icon]" align="right" height="60" weight="60"></if> HTML Code:
<b>$news[title]</b> HTML Code:
<div align="justify">$news[message] - scoop submitted by $news[postusername]</div> Go to your forum manager and create one news forum for each news category you desire to have on your news page. Also choose their display order at this step by modifying the display orders of the forums themselves. Note their forum #'s Step 4: Prepare the News Page Open your vBadvanced CMPS control panel and select "Add Module" Module Title: News Digest File to Include: newsdigest.php Templates to Include: adv_portal_newsdigest_date, adv_portal_newsdigest_category, adv_portal_newsdigest_item Step 5: Activate the Module Go to your page settings and turn the original news module off (It's redundant). Enter the forum #'s of each forum you want in any order (the display order of the categories is the same as the forums. Turn the newsdigest module on. --------------------------------------------------------- FINISHED. Version History Version 1.0.0 had several little glitches due to me rushing it out the door in my excitement from creating my first big hack. I'll demonstrate a bit more patience in the future. Version 1.0.1 (and prior) has a serious month wrap bug. Version 1.0.2 is current. If you like this hack please click install - thx. --------------------------------------------------------- Supplemental Hack: Bump and Debump News The date of the news is important with this hack. If you find an item displaying on the wrong day then you can use the following tools to scoot it around. Note - this "supplemental" hack is almost exactly like Rigel Kentaurus' "Bump Thread and Make Thread Older" hack, so I'm not going to take any credit for originality. Here is the modified version of his hack for bumping news items around for the digester. Code:
Code Modifications: 2 in 1 file |
a onsite example would be cool.. ;)
|
|
Quote:
|
Quote:
|
Out of beta now - it's been running 12 hours on my site and I've tested everything I think. I will pitch in if it causes problems.
My apologies for getting all giddy yesterday and rushing this out a wee bit early - this is my first major hack (though it's nothing compared to what I've planned). |
sweet dude :D:D:D
honestly - i always wanted this sort of setup for my old board (running phpbb :S ) this will allow the 5 or so news posters to put up news throughout the day and not continue to make new boxes, that clutter. it was hard to understand what you meant at first, until i saw your example. i'll keep you posted after some testing in a few days.... |
Found a display bug. I was using vbdate (); out of habit, but apparently that causes problems for any visitors who aren't on the same time zone as the server. Corrected by simply changing the newsdigest.php file - no changes to the install instructions or templates necessary.
|
This has been working a week now without any errors on my setup. Anyone have any ideas for improvements?
|
This is gorgeous but how do I only get 2 days worth ... and not a whole HUGE string of days ... ?
I'm installing it on www.whatisnew.com |
Quote:
PHP Code:
PHP Code:
|
Thank you for the very fast response !
Now, it is starting to take shape by showing just 2 days. However, it is showing up to 18 stories from the same category. I've looked where to change this to just up to 5 but I'm not sure. The story length cut down to 100 causes some of the stories to have all of the text linked/underlined. I've set it to 200 and stories are all red past a certain point. Any ideas? |
Quote:
|
Quote:
I've updated the front of www.whatisnew.com now and am adding more of these "news" forums for each category. |
Quote:
Signing off now, and have a good day. |
Thanks a bunch.
I very pleased with it, you did a great job on it. Is there any chance of getting some type of mod that would count the replies to a news article and put (# comments) next to it? *edit* Now that brings up, how would you moderate the new thread, but not the replies? |
I think you can set up a forum so that only new threads are moderated and not new posts without performing any hacks.
Anyway, ENWorld runs an archive of news items by using vbulletin's syndicator - it shows the 20 most recent news items for each topic. To add one to go with this system create a new page, turn all modules off on that page and point it's custom content at a new template (I used adv_portal_headlines) The content for us is... HTML Code:
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="tborder"> For this to work on your page you have to go to vboptions >> syndication and turn it on, choosing XML syndication. At that point a link will appear in each forum "Syndicate this page" Follow this instructions that appear. If you need any help just yell. |
Quote:
PHP Code:
PHP Code:
PHP Code:
Doing that captures the reply count. You can now slip it into the news item by putting $news[replycount] into the template. For example, change the adv_portal_newsdigest_item template to: HTML Code:
<div align="justify">$news[message] - submitted by $news[postusername]. <a href="showthread.php?t=$news[threadid]">Comments: $news[replycount]</a></div> |
Thanks a bunch. :)
I ran across this though after doing the above. Sorry to be a bother, still relatively new to php. Code:
Database error in vBulletin 3.0.3: |
No problem :)
|
Hmm.. Try thread.replycount instead of just replycount
EDIT: That will work, though you'll need to make it alias to something else so that you can read the resultant variable. Try thread.replycount AS comments Then in the template the variable will be $news[comments] EDIT2: To clarify the query will read as follows when you're done. SELECT thread.threadid, thread.replycount AS comments, postusername, postuserid, ...and so on... |
Yuppers. That work.
And i'm just about done with the other part now too. Just need to finish linking it somewhere. :) Edit 1: Ok, found the syndication needed to be turned on was the external javascript. I wasn't getting anythign with the xml on. http://ahazi.org/index.php?page=pastnews <--- But link at bottom is not working and i'm not seeing the link you talked about showing up either in the forums. |
Oops, sorry.
We've got so many hacks running around on EN World it's hard to remember what the default features are.. The external javascript is kicked out by the hack in this thread https://vborg.vbsupport.ru/showthread.php?t=59776 If you want to encourage people to syndicate your news I'd recommend it. |
Just when you think everything's fine the file goes haywire when the month wraps over. New version uploaded. This one doesn't rely on the MySQL Unix Timestamp function but instead uses strtotime(); to find the UNIX timestamp for the start of each of the last 8 days (including today).
|
Quote:
I tried this: PHP Code:
PHP Code:
**It also seems to be showing them in the wrong order (yesterday's first followed by today's underneath*** I would like it to only display one digest at a time, updated daily, which includes all news posts from the last X number of days (instead of one digest a day displaying just items from that day) is that easily possible? |
Quote:
1. Get the range of days (possibly using $_REQUEST or $_POST so that users can look stuff up). 2. Use strtotime() to convert the range to Unix timestamps. 3. Run the query, putting the posts into an array sorted by time. 4. Divide the array up by days within the range. 5. Further divide by categories 6. Assemble it. Doing it this way would save a LOT of queries. |
BTW, to be honest, this should be a default feature of vba_cmps IMO
|
Great Michael! It worked.
I just had to change my forum.icon to forum.fhbanner. That was different from the pervious version also. :) |
Quote:
That isn't intended to sound demanding at all, merely inquisitive. |
Hmm. Is there an easy way to have it just display the title of the thread in the news forum and have that title link to the article?
|
I'll do some reworking after I finish a server upgrade for EN World.
|
Quote:
|
I have been heavily modifying your code to fit my site (this is a fantastic script by the way) and I have run into a wall. I have split up my news posts into their respected category forums, but there is one annoying problem. The main page does not sort the news by time posted. Instead it is done (I believe, could be mistaken) by which forum it searches through first. How would I go about changing this so it is sorted by time posted? Again, fantastic hack!
|
It's been awhile since I've looked at this hack, so I'm not sure how to dodge that problem. I'm currently enrolled in an SQL course at ITT Tech, and once I finish it I should be better equipped to deal with this functional but still somewhat glitchy hack. This is what I have in mind for the next version.
Any other suggested features would be welcome. |
I really wanted to see this mod into action :ermm: anyone has a live link? this is what i'm getting in the link from the first post:
Quote:
|
Quote:
http://lutte.fnnation.com/nouvelles.php You can see the real mod in action with this link: http://www.enworld.org/index.php |
Quote:
The link above's corrected, but it is now at simply http://www.enworld.org |
I really would like to use this... But I'd like to keep some of the functionality of the original news posting for vBA. Namely being able to reply to the news posts and being able to "Read More" ... Any quick fix for this?
|
GiJoe,
Take a look at my site: http://www.ahazi.org It has the comments which was added in from the discussion on the 2nd page of this thread. Is that basically what you mean? |
This has been installed on my website :)
|
All times are GMT. The time now is 10:57 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|