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] AltairCMS Modification: vB News Integration

Mother effin' clouds
Loyal Member
Joined
Apr 13, 2008
Messages
1,534
Reaction score
448
AltairCMS Modification: vB News Integration
Disclaimer: I did not develop / design / assist in the development of AltairCMS by AuroX. I do not recommend nor discourage the use of this CMS and this CMS was simply chosen based on the fact it seems to be taking over Cype as its successor. This is not a performance / optimization / improvement related release. Secondly, I also do not recommend nor discourage the use of vBulletin - I personally dislike vBulletin, but due to its popularity, I tend to work a lot with it!

Pre-Requisites:

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

Background:
Simply, this is a modification of AltairCMS' "pages/news.php" file. It utilises jQuery and the jQuery Templates Plugin to fetch thread details from your vBulletin forum via vBulletin's External Data Provider feature and replaces the news fetched from AltairCMS' news table (at the homepage) with threads directly from your vBulletin forum - you will be able to specify which forum(s) you want to retrieve the latest threads from (along with the total results returned).

As I am utilising the JavaScript External Data Provider, the arguments and returns are quite limited, therefore, you will only be able to fetch the following via this method: Thread Id, Title, Poster, Thread Date, Thread Time. The method I am utilising for this modification is extremely simple and requires no server-side processing but instead, client-side processing. If you want wider capabilities, please look into manipulating your vBulletin forum's RSS feeds.

Aim
Do Not Repeat Yourself.

News.php:
PHP:
<?php
/**
 * AltairCMS v3 by AuroX
 *
 * vBulletin News Integration by Ian Lai <http://www.fyianlai.com>
 * More Info: http://forum.ragezone.com/f427/web-altaircms-modification-vb-news-723188/#post6137306
 * Other Notes: I did not create or design this CMS. This file is
 * simply put, a modification of the original 'news.php' in AuroX's
 * AltarCMS v3.
 **/
$return = $tbodyid = '';

// Path to vB Showthread.php
$vB_Thread = 'http://www.umaple.net/showthread.php?t=';

// Path to vB External Data Provider
$vB_External = 'http://www.umaple.net/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.
    Example:
    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.
  7. End Result...
SaintsIan - [Web] AltairCMS Modification: vB News Integration - RaGEZONE Forums

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."
  2. Cype CMS
    This is not so much of a problem, but I just realised AltairCMS was based on Cype CMS, however, I have not tested whether my modification to the AltairCMS' "news.php" will function as expected with CypeCMS (unless of course, if it is a direct rip!), so please do so at your own risk.

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!
 
Last edited:
Back
Top