vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   [RELEASE v2.x] OPNews v1.0 << Not just another 'news' script. (https://vborg.vbsupport.ru/showthread.php?t=26562)

DjSao 08-28-2001 09:05 AM

One more thing, the posting date is screwed up, it shows the posted date but only server time, the timezeone offset doesnt work.

merk 08-28-2001 09:44 AM

Ill look into it, i dont really have that problem, 90% of my members are in the servers timezone :o

merk 08-28-2001 10:49 AM

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 ;)

DjSao 08-28-2001 11:39 AM

Thanx again, ill be here with more work for you as soon as i figure out what other stuff should be added :)

DjSao 08-28-2001 12:12 PM

$newsitems = 1;

this line doesn't do anything, you havent put out a limit that referrs to $newsitems.

Mega 08-28-2001 12:38 PM

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 :)

DjSao 08-28-2001 12:43 PM

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

JJR512 08-28-2001 03:01 PM

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).

merk 08-28-2001 09:22 PM

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 :)

merk 08-28-2001 09:24 PM

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 ;)


All times are GMT. The time now is 02:18 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.01836 seconds
  • Memory Usage 1,749KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete