View Single Post
  #4  
Old 12-07-2005, 09:37 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The script doesnt currently support pagination (ive never needed it) and is limited to a fixed number of items.

index.php should look something like:

PHP Code:
<?php
/*======================================================================*\
|| #################################################################### ||
|| # ozfortress custom news index script # ||
|| # written to run on a vBulletin installation # ||
|| # ---------------------------------------------------------------- # ||
|| # Copyright ?2005 merkworx.com # ||
|| #################################################################### ||
\*======================================================================*/
 
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
 
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);
define('THIS_SCRIPT''index_news');
 
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
 
// get special data templates from the datastore
$specialtemplates = array(
    
'smiliecache',
    
'bbcodecache');
 
// pre-cache templates used by all actions
$globaltemplates = array('GENERIC_SHELL''index_postbit''postbit_onlinestatus''bbcode_code''bbcode_html''bbcode_php''bbcode_quote');
 
// pre-cache templates used by specific actions
$actiontemplates = array();
 
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once(
DIR '/includes/functions_bigthree.php');
require_once(
DIR '/includes/class_bbcode.php');
require_once(
DIR '/includes/class_postbit.php');
 
    
$newsitems $vbulletin->db->query_read("
        SELECT thread.* , post.*, user.username AS uname,
        IF(user.displaygroupid=0, user.usergroupid, user.displaygroupid) AS displaygroupid
        FROM `thread`
        LEFT JOIN `post` ON ( thread.firstpostid = post.postid )
        LEFT JOIN `user` ON ( post.userid = user.userid )
        LEFT JOIN `deletionlog` ON (deletionlog.primaryid = thread.threadid AND deletionlog.type = 'thread')
        WHERE thread.forumid = 9
        AND deletionlog.primaryid IS NULL
        ORDER BY thread.dateline DESC
        LIMIT 15"
);
 
    
$foruminfo fetch_foruminfo(9);
 
    
$postbit_factory =& new vB_Postbit_Factory();
    
$postbit_factory->registry =& $vbulletin;
    
$postbit_factory->forum =& $foruminfo;
    
$postbit_factory->cache = array();
    
$postbit_factory->bbcode_parser =& new vB_BbCodeParser($vbulletinfetch_tag_list());
 
    while (
$newsitem $vbulletin->db->fetch_array($newsitems))
    {
        
$postbit_obj =& $postbit_factory->fetch_postbit('index_postbit');
        
$HTML .= $postbit_obj->construct_postbit($newsitem);
    }
 
    
$vbulletin->db->free_result($newsitems);
 
    
$navbits construct_navbits(array(
        
'' => "news index"));
 
eval(
'$navbar = "' fetch_template('navbar') . '";');
eval(
'print_output("' fetch_template('GENERIC_SHELL') . '");');
 
?>
You will need a template, index_postbit, which basically can contain anything the normal postbit template contains. (i copy/pasted then modified)

You should change the forumid in the query and fetch_foruminfo() functions to one that matches your forum for news.

You will also need to add a hook into postbit_factory with the contents:
PHP Code:
if($postbit_type == 'index_postbit')
{
$out =& new vB_Postbit_Post();
$out->templatename 'index_postbit';
$handled_type true;

Aside from that, it should just work - you will obviously need to modify it slightly if you only want some of the pagetext to show - something you're probably going to have to get a bit dirty with, I'd stab a guess at the best place to do it would be postbit_display_complete (maybe postbit_display_start) checking for $this->templatename == 'index_postbit' to make sure you're working on a news postbit.

Maybe I should tidy it up more and release it, but eh
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01301 seconds
  • Memory Usage 1,808KB
  • 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
  • (2)bbcode_php
  • (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_onlinestatus
  • (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
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete