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

 
 
Thread Tools
Details »»

Version: , by merk merk is offline
Developer Last Online: Mar 2012 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 08-26-2001 Last Update: Never Installs: 0
 
No support by the author.

Well, after finding 'PluhNews', i thought to myself, why not create something that uses templates, and the $DB_site class?

Well, after a bit of twiddling, i reduced the querys to just one, and Got it working, took a while tho D:

First off, youll need to create 2 templates.

newsbit:
Code:
Posted By <a href="$forumspath/member.php?s=&action=getinfo&userid=$newsarray[postuserid]"><b>$newsarray[postusername]</b></a> at  <i>$dateposted</i>
</center>

<blockquote></a>$cookedthread</blockquote><center><a href="$forumspath/showthread.php?s=&threadid=$newsarray[threadid]"><b>$newsarray[replycount]</b> $commenttext</a> Last comment was by <b>$newsarray[lastposter]</b></a></center>

<hr noshade height="1" width="60%">
This is just example code, basically the same as PluhNews' Code, i dont have time to make it a bit mroe spicey, but im sure you can work it out.

shownews:
Code:
Your Header Code Here

$newsbits

Your Footercode here.
And finally, create news.php in the forum root directory, and put this in it:
PHP Code:
<? 
error_reporting(7);
$templatesused='header,headinclude,phpheader,newsbit,shownews';
$loadbirthdays=1;
$loadmaxusers=1;

//Configuration Options
//What is the ID of your News forum?
$newsforums = 107;

//How many news items should be displayed?
$newsitems = 10;

//Path to your forums directory (leave out trailing slash)
$forumspath = "/forum";

require('./global.php');

$newsquery = "SELECT thread.*, post.*";
$newsquery .= " FROM thread,post";
$newsquery .= " WHERE post.threadid=thread.threadid";
$newsquery .= " AND thread.forumid=$newsforums";
$newsquery .= " GROUP BY thread.threadid";
$newsquery .= " ORDER BY thread.dateline DESC";

$news=$DB_site->query($newsquery);

while ($newsarray=$DB_site->fetch_array($news)) {

        $dateposted = vbdate("jS F Y, H:i",$newsarray[dateline]);

if ($newsarray[replycount]==1) {
    $commenttext = "Comment";
}
else {
    $commenttext = "Comments";
}

    $cookedthread=bbcodeparse2($newsarray[pagetext],"1","1","1","1");
    $test1 .= "test";
    eval("\$newsbits .= \"".gettemplate("newsbit")."\";");

}

eval("dooutput(\"".gettemplate("shownews")."\");");

?>
Thats basically it really!.

Im sure there are a few little errors in my coding, im a bit rusty with PHP

Next i plan on making a 'column' system(ie http://fortress.challenge-au.com) And actually, its for that site

<edit>
Im not sure if this supports multiple forums. Some feedback maybe?

Also- maybe there may be some point in using replacment variables in this, but hey, i couldnt be bothered
</edit>

Show Your Support

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

Comments
  #12  
Old 08-28-2001, 09:05 AM
DjSao
Guest
 
Posts: n/a
Default

One more thing, the posting date is screwed up, it shows the posted date but only server time, the timezeone offset doesnt work.
Reply With Quote
  #13  
Old 08-28-2001, 09:44 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ill look into it, i dont really have that problem, 90% of my members are in the servers timezone
Reply With Quote
  #14  
Old 08-28-2001, 10:49 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have gotten the Date to show, as the users setting.

You need to replace, at line 43
PHP Code:
$dateposted date("jS F Y, H:i",$newsarray[dateline]); 
with

PHP Code:
$dateposted vbdate("jS F Y, H:i",$newsarray[dateline]); 

Thanks Kier
Reply With Quote
  #15  
Old 08-28-2001, 11:39 AM
DjSao
Guest
 
Posts: n/a
Default

Thanx again, ill be here with more work for you as soon as i figure out what other stuff should be added
Reply With Quote
  #16  
Old 08-28-2001, 12:12 PM
DjSao
Guest
 
Posts: n/a
Default

$newsitems = 1;

this line doesn't do anything, you havent put out a limit that referrs to $newsitems.
Reply With Quote
  #17  
Old 08-28-2001, 12:38 PM
Mega
Guest
 
Posts: n/a
Default

lol

I guess you have to

add this:
PHP Code:
$newsquery .= "LIMIT $newsitems"
right after:
PHP Code:
$newsquery "SELECT thread.*, post.*";
$newsquery .= " FROM thread,post";
$newsquery .= " WHERE post.threadid=thread.threadid";
$newsquery .= " AND thread.forumid=107";
$newsquery .= " GROUP BY thread.threadid";
$newsquery .= " ORDER BY thread.dateline DESC"
NOT sure... my SQL is a bit rusty
Reply With Quote
  #18  
Old 08-28-2001, 12:43 PM
DjSao
Guest
 
Posts: n/a
Default

Nope that didnt work, i gave it a try and added the limit thingie myself

Replace:

$newsquery .= " ORDER BY thread.dateline DESC";

With this:

$newsquery .= " ORDER BY thread.dateline DESC LIMIT $newsitems";

Now, how bout adding a pagenav at the bottom, so that you can see older news
Reply With Quote
  #19  
Old 08-28-2001, 03:01 PM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, this little request is going to throw a major complication into the works, I know, but I just have to ask.

Instead of limiting the number of news items that show up to a fixed number (with $newsitems), could there be a way to show news items during the past certain amount of time? For example, show all from the past two days, or something like that (the time limit would be a admin-set variable, just like $newsitems).
Reply With Quote
  #20  
Old 08-28-2001, 09:22 PM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Whoops

Forgot to add the LIMIT SQL bit back in after testing


PHP Code:
<? 
error_reporting(7);
$templatesused='header,headinclude,phpheader,newsbit,shownews';
$loadbirthdays=1;
$loadmaxusers=1;

//Configuration Options
//What is the ID of your News forum?
$newsforums = 107;

//How many news items should be displayed?
$newsitems = 10;

//Path to your forums directory (leave out trailing slash)
$forumspath = "/forum";

require('./global.php');

$newsquery = "SELECT thread.*, post.*";
$newsquery .= " FROM thread,post";
$newsquery .= " WHERE post.threadid=thread.threadid";
$newsquery .= " AND thread.forumid=$newsforums";
$newsquery .= " GROUP BY thread.threadid";
$newsquery .= " ORDER BY thread.dateline DESC";
$newsquery .= " LIMIT $newsitems"

$news=$DB_site->query($newsquery);

while ($newsarray=$DB_site->fetch_array($news)) {

        $dateposted = vbdate("jS F Y, H:i",$newsarray[dateline]);

if ($newsarray[replycount]==1) {
    $commenttext = "Comment";
}
else {
    $commenttext = "Comments";
}

    $cookedthread=bbcodeparse2($newsarray[pagetext],"1","1","1","1");
    $test1 .= "test";
    eval("\$newsbits .= \"".gettemplate("newsbit")."\";");

}

eval("dooutput(\"".gettemplate("shownews")."\");");

?>
Im not actually sure if this works, im at work at the moment, and i dont have access to my database to test it.

Basically i just added the last line to $newsquery.


Watch out for v1.5 soon!
Itll have more features! (who knows what at the moment )
I plan on adding multiple forum support, which ive done in my version, but its only basic, and you need to know the forumid(any forumid works atm, gotta fix that)
Maybe news headlines, just like PluhNews, i like that feature.

Im also working on OPColumns, which will do similar features to here.

If you can sugest any more features you would like, ill try work on them
Reply With Quote
  #21  
Old 08-28-2001, 09:24 PM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Mega
lol

I guess you have to

add this:
PHP Code:
$newsquery .= "LIMIT $newsitems"
right after:
PHP Code:
$newsquery "SELECT thread.*, post.*";
$newsquery .= " FROM thread,post";
$newsquery .= " WHERE post.threadid=thread.threadid";
$newsquery .= " AND thread.forumid=107";
$newsquery .= " GROUP BY thread.threadid";
$newsquery .= " ORDER BY thread.dateline DESC"
NOT sure... my SQL is a bit rusty

Your ALMOST right. just you need to add a SPACE before the start of limit, just my coding style
Reply With Quote
 


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 03:12 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06323 seconds
  • Memory Usage 2,315KB
  • Queries Executed 25 (?)
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_code
  • (8)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (6)postbit_onlinestatus
  • (11)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete