Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Web] CP Web News ( vB News Integration )

http://ranengine.ddns.net
Joined
Nov 16, 2009
Messages
450
Reaction score
87
Pre-Requisites:

  • vBulletin 3.8.x
  • External Data Provider -> External JavaScript Enabled
    More Details: vBulletin Manual
  • Your CP Website
  • jQuery (Included) + jQuery Templates Plugin

PHP:
<?php

$return = $tbodyid = '';

// Path to vB Showthread.php
$vB_Thread = 'http://www.my-forum.com/showthread.php?t=';

// Path to vB External Data Provider
$vB_External = 'http://www.my-forum.com/external.php?type=js&forumid=4';

if(!empty($_GET['id'])){
    header ("Location: ".$vB_Thread.$_GET['id']);
}

echo '
<br/><br/>
<table width="580px" border="0" cellpadding="0" cellspacing="0">
    <tbody id="maple-news-cont">
        <tr>
            <td width="64">
                <span style="float: left;">
                <img src="http://forum.ragezone.com/images/news/bbs_notice_title.gif" alt="Notice" border="0" /></span>
            </td>
        </tr>

        <tr>
            <td height="4" />
        </tr>

        <tr>
            <td colspan="3" style="background-color:#b8b8b8;" height="3"></td>
        </tr>
        <tr>
             <td height="4" />
        </tr>
'.$return;
?>
    </tbody>
</table>
<script id="maple-news-tmpl" type="text/x-jquery-tmpl">
    <tr>
        <td>[${date}]</td>
        <td>
            <div align="left" valign="left">
                <a href="<?php echo $vB_Thread?>${threadid}"> ${news} </a>
            </div>
        </td>
        <td>
            <b>${author}</b>
        </td>
    </tr>
</script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo $vB_External?>"></script>
<script src="js/jquery.tmpl.js"></script>
<script type="text/javascript">
$(function () {
    var MNVar = $.map(threads, function(e, n) {
        return {
            threadid: threads[n].threadid,
            news: threads[n].title,
            date: threads[n].threaddate,
            author: threads[n].poster
        };
    });
    $('#maple-news-tmpl').tmpl(MNVar).appendTo('#maple-news-cont');

});
</script>

Installation:

  1. Ensure you cover the pre-requisites above.
  2. Replace "/pages/news.php" with the "news.php" above
  3. Open "news.php."
  4. Look for "$vB_Thread" and set this to the URL of your vBulletin "showthread.php" file (and appended with ?t=),


    Example:
    Code:
    http://www.my-forum.com/showthread.php?t=
  5. Look for "$vB_External" and set this to the URL of your vBulletin External Data Provider file.

    Code:
    http://www.my-forum.com/external.php?type=js&forumid=4

    Forum ID = Forum to retrieve threads from (you can use the argument 'forumids' for multiple forums).
  6. Save "jquery.tmpl.js" to your AltairCMS' "js/" directory.

Problems
  1. DnP Firewall.
    If you have installed the vBulletin DnP Firewall plugin, you will need to modify your "global.php" file to check for "external.php" and ensure it does not include the DnP gateway if the file being accessed is "external.php."

Improvements
You can achieve quite a lot with this with JavaScript alone. For example, you can use the substr() function to shorten thread titles and add ellipses where required, or, you can consider adding some sort of prefix detection to display the relevant post icon / image. Additionally, the jQuery template is encapsulated in <script> tags with id "maple-news-tmpl", so feel free to modify the template to your expectations (and perhaps style it up with a bit of CSS). I have clearly provided the foundation here, so feel free to modify and improve to your personal expectations

Help / Support
I am not the type that likes providing thorough support and I much prefer you Google any uncertainties. In the event this is not possible, I will try my best to entertain your enquiries :)

Long butt post for the win. Good luck!

By: SaintsIan
 
Last edited:
Skilled Illusionist
Joined
Jul 29, 2011
Messages
305
Reaction score
18
i think not all can try with this.
vbulletin is expensive :(

the query i think is good it is base on java.
 
Back
Top