View Single Post
  #33  
Old 01-09-2001, 07:50 PM
Guest
 
Posts: n/a
Default

I just started playing with this and it works great for the purposes I need. I did modify it so it was more tightly integrated with vBulletin.

Full news system in a few lines of code.
Code:
<?php

require("global.php");

//   Newsforum -- The forum that the script will pull news headlines from.  Unless you want all 
//   your users to be able to update your news, you may want to consider limiting this forum to 
//   Moderators posting new threads...this is easily done via the vB control panel.

$newsforum = 11;

//   News Limit -- How many stories should be displayed?

$bfc_newslimit = 2;

$isnews = 1;
$newsbits="";
$threads=$DB_site->query("SELECT * FROM thread WHERE forumid=$newsforum ORDER BY dateline DESC LIMIT $bfc_newslimit");
while ($thread=$DB_site->fetch_array($threads)) {
  $postdate=date($dateformat,$myrow[dateline]+(($timeoffset+$bbtimezoneoffset)*3600));
  $posttime=date($timeformat,$myrow[dateline]+(($timeoffset+$bbtimezoneoffset)*3600));
  $replycount=$thread[replycount];
  $username=$thread[postusername];
  $newstitle=$thread[title];
  $threadid=$thread["threadid"];
  if ($replycount == "0") {
    $replies = "";
  }
  elseif ($replycount == "1") {
    $replies = "| (1 Comment)";
  }
  else {
    $replies = "| ($replycount Comments)";
  }
  $posts=$DB_site->query("SELECT post.userid, pagetext,user.username as username
                          FROM post LEFT JOIN user ON (post.userid = user.userid) 
                          WHERE threadid=$threadid ORDER BY postid LIMIT 1");
  $postinfo=$DB_site->fetch_array($posts);
  $userid=$postinfo[userid];
  $username=$postinfo[username];
  //$dept=$postinfo[dept],
  //$category=$posts[category];
  $message=bbcodeparse($postinfo[pagetext],$forumid,1);
  eval("\$newsbits .= \"".gettemplate("newsbit")."\";");		
} 

eval("echo dovars(\"".gettemplate("news")."\");");
News Template
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD><TITLE>$bbtitle - $forumtitle</title>
$cssinclude
</head>
<body>
$header
<center>
<table border="0" width="98%" cellpadding="2">
  <tr>
  <td bgcolor="#FFFFFF">$newsbits</td>
  </tr>
</table>
</center>
$footer
</body>
</html>
Newsbit Template:
Code:
<table width="{newswidth}" border="0" cellpadding="1" cellspacing="0" bgcolor="#6c6081">
  <tr>
 		<td>
   	  <table width="100%" border="0" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF">
   	    <tr><td valign="middle"><font face="Tahoma, Verdana, Arial" color="#afa3c5"><b>$newstitle</b></font></td></tr>
   	  </table>
   	</td>
  </tr>
</table>
<table width="{newswidth}" border="0" cellpadding="0" cellspacing="0" bgcolor="#EFEFEF">
  <tr>
 		<td valign="top">
 	   	<table width="100%" border="0" cellspacing="0" cellpadding="0">
    	  <tr><td valign="top"><p><b>Posted by: [<a href="member.php?action=mailform&userid=$userid">$username</a>] on $postdate at $posttime</b></tr>
   	   	<tr><td valign="top"><p>$message<br><br><smallfont><a href="showthread.php?threadid=$threadid">Read More</a> $replies<br><br></td></tr>
 	   	</table>
   	</td>
   </tr>   	
</table>
I am currently adding more portal like stuff to it but no previews. Of course I have a long way to go to catch up to PHP-Nuke but I like creating my own stuff. It is pretty sparse now but I will be adding to it over the day...

http://sitepointforums.com/news.php

[Edited by wluke on 01-09-2001 at 04:54 PM]
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01219 seconds
  • Memory Usage 1,777KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete