- Compatible XF Versions 1.x
- 1.3, 1.4, 1.5
- Additional Requirements
php 5.5 or newer,
Xenforo 1.x or 2.x (optional),
AppGini (optional) or PHPmyAdmin or HeidiSQL or similar
This is a really simple way to view in a Xenforo template a set of banners by automatically timed rotating out from a banner pool. Sounds complicated but it is simple.
Attention: this is will not be a complete step by step guide! I will give you only tips to find your own solution based on this guide. I will give you ideas to find your own way to make such things.
All you need is a pool from 3 up to x (I prefer max 10 banners) banners, saved as *.gif, *.jpg or *.png in a defined directory on your web space or server. The directory must be accessible public and you have to put in all your banners.
There are 2 simple PHP files called b_timer.php and b_select.php that should be placed at the root directory like this:
b_select.php look at a database we create later and grab such info from. It also displays the number of banners you set up in b_select.php.
b_timer.php uses a little bit jquery to auto reload the b_select.php in an interval you can set up.
Now, the really hard part. Uhhh...
I use an AppGini database creation tool to make a really simple database with these red marked columns:
- ID - just the ID column
- Banner - contains only the path to the banner image
- Link - contains the link to each banner, if you click a banner
- Text - contains an alt text to each banner
in AppGini it looks like this when you create your own database:
AppGini is available in a free version and in many languages. It also has a support forum.
AppGini is for me the easy and fast way I prefer to make the database and a nice frontend input mask like this:
Where I can simple and fast take inputs to add new banners, change banners, delete banners, ... and at the same time save and delete the banner in the directory where b_select.php grab them out.
To view the database (first attachment) and the input fields (attachment above) you have to log in to the frontend of your database. So you have with AppGini also the ability to use more than one database member or groups with different rights ... its an amazingly powerful but simple tool. But enough words about AppGini now.
If the database exists and you have input one or more banners in, then our both PHP files are needed now.
Let's take a look at b_select.php:
You don't have permission to view the code content. Please Log in or register now. Log in or register now.
This displays your banners and this responsive. So if you will display 3 banners, they can automatically be displayed in one line or in multiple lines one after each other:
That's all. I know, the code is not optimized but it works for me now for certain years. It works with PHP 5.5.x and newer ones up to PHP 7.3.x and I think you can use wide parts of it also for Xenforo 2.x with a little bit work at the Xenforo template code above.
I am open to constructive criticism and new ideas.