Get started with PHP-Fusion

Banner Manager Tutorial

PHP-Fusion has a Banners Admin page that allows you to do some sweet stuff, if you haven't discovered this feature yet, here is a bit of information to get you started.

Getting started...


Figure 1.

PHP-Fusion v7.x comes with a 'Banners' link in the Admin Panel as shown in Figure 1. Selecting this Admin Page brings up an editor page to the center panel. This is where we insert our banner code. If we split our header section in two, Banner 1 is the left part, while Banner 2 is the right part, both showing up inside the header limits of your selected theme.

Banner 1 has a trick to it and it is that the logo you set up in the main settings, (which is also the same logo you see when loging in, and when you set the maintenance mode to On) will be replaced in the header with whatever you set in Banner 1. (Replacement only takes place in the header, the logo you set in Main settings will still show up on maintenance page, and login/out pages.)

So, just what kind of code can you use as a Banner? Well, simply put, any code can be used. HTML, PHP and JavaScript code snippets are accepted and saved to your banner. You can preview it to make sure it displays, and then save it to see it show up on the header of your site.

Getting your hands dirty with some PHP code...

This might be intimidating for the new user, and for the beginner to PHP, but it is rewarding to give this a shot and play around with the customization power of PHP. Using some PHP code along with our banner, PHP-Fusion makes it easy to distinguish between regular Members (registered users), Guests (visitors who have not registered yet), and Admins (the guys who wear the top hats and are always in control - ok almost always). By using a little PHP in the Banner code, you can target different banners to your users and display only one at a time depending on what type of user is accesing your site.

Now, lets go over the PHP code that you would use to get this functionality for your banner:

<?php
if(iGUEST){
?>
[BANNER CODE FOR GUEST HERE]
<?php
}elseif(iMEMBER){
?>
[BANNER CODE FOR MEMBER HERE]
<?php
}elseif(iADMIN){
?>
[BANNER CODE FOR ADMIN HERE]
<?php
}
?>

The code above is an example of how we can target our code to different user levels. This can be ad campaign code, social network links, images, linking guests to registration page, anything you may need. The example above can also be used on Custom Pages, Custom Panels, in short, it fits anywhere if the CMS allows PHP input. You will be able to notice if PHP input is allowed if you see a button with <?php ?> in it (and TinyMCE is not activated - note that the Banners input will not use TinyMCE even if it is activated).

 

img_facebookCode
Figure 2.

A practical example, step by step

Ok, so far, you should have a very basic grasp of what you can do with your banners. Now, we will go over a simple Facebook 'Like' box, or button. We are going to place that in our banner. First, we need to get the code from Facebook.

In Figure 2, we can see the page where Facebook makes the Like button code available for us. There will be two options, the iframe code, or their proprietary XFBML code. Both depend on javascript to be on, and both achieve the same result, although the XFBL is more functional in terms that it automatically resizes the height of the button's object to match the amount of Avatar's rows.

This example uses the standard Like button, which includes a string of text recounting how many people like the page, and also displays the avatars of those who like the page. This is all customizable in the button maker from the Facebook page linked above.

So, by now you should have the code and all you need to do is copy & paste it into the Banner 2  section of your PHP-Fusion site's Banner Admin page.

And so, without too much embellishment, and plain out of the Facebook code maker, our brand spanking new Like button is up there in the header, spreading the selected URL throughout Facebook via the Like button presses your visitors make.

A practical example: Final Result

After saving that banner code onto Banner 2  your site should look like this:

img_finalBanner
Figure 3.
 
Posted by Elvenelf on January 26 2011 16:22:21
2 Comments · 51080 Reads · Print
Comments
#1 | wolfbbs on Feb 27 2011 at 05:24:45
I think this works better actually, The other way the only thing a superadmin sees is the member banner..
Code Gist:

<?php
if(iSUPERADMIN){
?>
[BANNER CODE FOR SUPERADMIN HERE]
<?php
}elseif(iADMIN){
?>
[BANNER CODE FOR ADMIN HERE]
<?php
}elseif(iMEMBER){
?>
[BANNER CODE FOR MEMBER HERE]
<?php
}elseif(iGUEST){
?>
[BANNER CODE FOR GUEST HERE]
<?php
}
?>
#2 | phreik on Jul 24 2011 at 20:38:55
Hi is there any way to do this with sections like news.php with a certain banner image and then the forums with another image and then the the gallery and so on...
Post Comment
Please Login to Post a Comment.
Ratings
Rating is available to Members only.

Please login or register to vote.

Awesome! Awesome! 33% [1 Vote]
Very Good Very Good 0% [No Votes]
Good Good 0% [No Votes]
Average Average 67% [2 Votes]
Poor Poor 0% [No Votes]