vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Looking for a news script. (https://vborg.vbsupport.ru/showthread.php?t=123737)

Hobokin 08-12-2006 04:46 AM

Looking for a news script.
 
I want to find a lightweight script (can be included in a non-vb page) that can pull the first post out of x number of threads from a specific forum (or two) then can count the number of additional posts (for a Comments (12)) type thing.

I don't want to use a CMS / Portal whatever as they are bloated and tend to use VB styles.


I have searched and searched but cant find anything.

Thanks in advance

Edit: I looked into vbExternal, it is pretty close to what I want. The only problem is it operates from inside the vb folder. So it can only be used to include from one forum. I want similar functionality but I also would like for different news to be pulled from a different forum for say subdomains or addon domains. for instance www.site1.com pulls news from forum 2 while hosted.site1.com pulles from forum 5 and www.site2.com pulls from forum 12

Thanks

Well. I looked some more, checked out VbExternal again. waited for a response. And came up with this.

It works, but i'm not an expert coder at all. A lot of it is ripped from vbExternal I was not impressed with the limitations of it. So please someone, anyone read over the code and tell me if there are any obvious flaws or any improvements.

PHP Code:

<?php
// Vb news test. Note: a lot of this is reworked vbexternal code. 
// Actually all of it is :P Thanks to Zero Tolerance.
// ob_start();

// I saw this in vbExternal, thought it looked cool
error_reporting(E_ALL & ~E_NOTICE);
define('THIS_SCRIPT''news');

$news_number '5'// Amount of news to pull
$news_forum '3'// From which forum?

// Change over to vb's directory so we can include global.php
$old_dir getcwd(); // used later maybe.
chdir('path/to/forum');
require_once(
'./global.php');

// Check to make sure the chdir took.
if( !file_exists('./includes/config.php'))
{
    echo 
"includes/config.php does not exist. Cannot continue.";
    exit;
}

function 
RunError($message ""){
    echo 
"<font size='1' face='verdana'>There was an error while processing vBExternal:<br />{$message}</font>";
    exit;
}

// Include some shit I think is important :P
require_once('./includes/class_core.php');
require_once(
'./includes/config.php');
require_once(
'./includes/class_bbcode.php');

// Test to make sure a forum was set.
if (!$news_forum) {
  
RunError("No Specified Forum to pull news from, Edit the script you bum");
}

// The actual Query WOOT!
$pulled_news $db->query("
            select t.*,p.pagetext
            from "
.TABLE_PREFIX."thread t
            left join "
.TABLE_PREFIX."post p on(p.postid=t.firstpostid)
            where t.forumid = 
$news_forum
            order by dateline desc
            limit 0,
$news_number");
      
$bbcode_parser =& new vB_BbCodeParser($vbulletinfetch_tag_list());
      
        while(
$News $db->fetch_array($pulled_news)){
      
$thread_id $News['threadid'];
      
$thread_title $News['title'];
      
$post_userid $News['postuserid'];
      
$post_username $News['postusername'];
      
$post $bbcode_parser->parse(unhtmlspecialchars($News['pagetext']), $f);
      
$comments vb_number_format($News['replycount']);
      
      echo 
"<a href=\"http://www.mysite/forum/showthread.php?p=$thread_id\">$thread_title</a>";
      echo 
"Posted by <a href=\"http://www.mysite.com/forum/member.php?u=$post_userid\">$post_username</a>";
      echo 
"$post";
      echo 
"Comments: <a href=\"http://www.mysite.com/forum/showthread.php?p=$thread_id\">$comments</a>";
    }
    
chdir($old_dir);
?>


Freesteyelz 08-12-2006 08:15 AM

You may be interested in christianb's script, which is close to being released. He's looking for beta testers. You can find the discussion here. :)


All times are GMT. The time now is 02:13 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.01066 seconds
  • Memory Usage 1,735KB
  • 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
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete