25 May 2013 
Support Center » Knowledgebase » Particle Boxes: Creating Particle Boxes (FBB Ver. 2.1 and earlier)
 Particle Boxes: Creating Particle Boxes (FBB Ver. 2.1 and earlier)
Article
You can customize your site by creating your own particle boxes.


These can be used for quotes, statistics, or even content such as Google's Add Sense. Just by changing a few things, you could create just about any particle box you want...



BEFORE PROCEEDING WITH THE FOLLOWING INSTRUCTIONS, BACK UP THE FOLLOWING FILES:


includes/common.php
language/*/common.php
templates/fusionbb/header _left.php
templates/fusionbb/ footer_both.php
templates/fusionbb/ footer_right.php




  • Create a title for your referral particle box:

    Open your language/*/common.php file and, toward the end before the ?> , add the following line:

    $lang_str['REFERRAL']= 'Referrals';

  • Create a template var called PARTICLE_REFERRAL.

    Open your includes/common.php file.

    Look for:

    $template->setTemplate Var("PARTICLE_RECENT_PICT URES",$particle->creat eThumbPicBox());

    Then below that add:

    $template->setTemplate Var("PARTICLE_REFERRAL",$ particle->createReferr alBox());

    Note:You'll have to do that step twice (once for the send header function, and once for the send footer function).

  • Now create a function called createReferralBox.


    Find:

    } $cache_data=null; return $this->particlebox['TH UMBPICS']; }

    And below that add:

    function createReferralBox() { global $session,$conf,$FBB_SESS, $template,$lang_str,$skin ;

    $referral = @implode('',@file(FBB_ROO T . "/custompb/referral_box.php"));

    $this->particlebox['RE FERRAL'] = str_replace("<!--BLANK _TITLE-->",$lang_str[' REFERRAL'],$this->part iclebox['BLANK']); $this->particlebox['RE FERRAL'] = str_replace("<!--BLANK _CONTENT-->",$referral ,$this->particlebox['R EFERRAL']);

    return $this->particlebox['RE FERRAL'];

    }


    Note: Take a close look at the lines starting with $this. The first line uses the particlebox['BLANK'] array. This is what the contents of that array look like:

    {$skin['tableopen']} <table border='0' cellpadding='3' cellspacing='{$skin['cell spacing']}' width='100%'> <tr> <th class='theader' align='left'> <!--BLANK_TITLE--> </th> </tr> <tr> <td align='left' valign='top' class='color1'>

    <!--BLANK_CONTENT--> ; <!--BLANK_EXTRA-->

    </td> </tr> </table> {$skin['tableclose']}


    The first command that starts with $this replaces the <!--BLANK_TITLE--> in the array with our language string , but at the same time it creates a new table in the particlebox array called particlebox['REFERRAL']. Now particlebox['REFERRAL'] looks like this:

    {$skin['tableopen']} <table border='0' cellpadding='3' cellspacing='{$skin['cell spacing']}' width='100%'> <tr> <th class='theader' align='left'> Referral </th> </tr> <tr> <td align='left' valign='top' class='color1'>

    <!--BLANK_CONTENT--> ; <!--BLANK_EXTRA-->

    </td> </tr> </table> {$skin['tableclose']}


    Then the second $this does another string replace, but this time it's on the particlebox['REFERRAL'] array that was created with the first $this command line.

    There is a <!--BLANK_EXTRA--> string in that template, but there wasn't any need for it in this mod. You can reuse that particlebox['BLANK'] array as many times as you like, just be sure an give your new array a unique name...

  • To customize the particlebox for Google Add Sense: open the referral_box.php script and replace the example referral code with the one that you get from Google's Add Sense site.

    Create a directory under your FusionBB directory called custompb and upload your referral_box.php file there.

    To make the referral particle box show up on your pages: Go to your templates directory and open your header_left.php file.

    Look for:

    <!--PARTICLE_ONLINE--& gt;


    And above that add:


    <!--PARTICLE_REFERRAL- ->


    Open your footer_both.php file. Look for:


    <!--PARTICLE_ONLINE--& gt;


    And above that add:


    <!--PARTICLE_REFERRAL- ->


    Open your


    footer_right.php file.


    Look for:


    <!--PARTICLE_ONLINE--& gt;


    And above that add:


    <!--PARTICLE_REFERRAL- ->



  • Save and upload all files to your server.



Note: This is what the referral_box.php file looks like (it's just the referral code that you get form Google's Add Sense web site):

//
<div align="center">
<script type="text/javascript"> ;<!--
google_ad_client = "pub-4282358225994806";
google_ad_width = 125;
google_ad_height = 125;
google_ad_format = "125x125_as_rimg";
google_cpa_choice = "CAAQweaZzgEaCA2ZyYC_NXeA KK2293M";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>





(Thanks to Dalantech (www.dalantech.com) for this 'How To' guide!)




Article Details
Article ID: 68
Created On: 10 Nov 2008 7:20 PM

 This answer was helpful  This answer was not helpful

 Back
 Login  
Email Address:
Password:
Remember Me:
 
 Search
 Article Options
Home | Submit a Ticket | Knowledgebase | Downloads
Language:

Help Desk Software by Kayako eSupport v3.30.02