Jump to content

banner rotator from database


Guber-X

Recommended Posts

this is one thing im pretty stumped on, i have done searches and tried a few different banner rotators, but they all rotate on page reload. im looking for time based rotator that doesnt require a page reload. as far as it goes, i have nothing thats working the way im looking for.

 

I have a database table called "featurebox" and the colums are "id", "imgsrc", "imgurl".

 

the other tough part is that i need it to switch with a background image of a table. my layout for this would not work if it was just a image in a table :/

I have a rotator working for it at this moment. but its in java, and i want to get rid of the java cuz it dont work to well with php or at least not well for me.

 

this is the page that im working on.

www.fightingforyesterday.com/index.php

 

that spot where u see some images changes in the box where "feature" is titled. thats just java and they have no links to click on. and i want to change it so each image has its own URL to goto. it is the same idea as a banner rotator, but of course its not for ads to other sites.

 

i dont really have any code that would be usefull to show you to help out. but if you want to see something just let me know

Link to comment
Share on other sites

AJAX is a mix of JavaScript and PHP.

 

Essentially, JavaScript can execute without a page reload.  So you use a JavaScript command to trigger a PHP script which, most often, generates a XML file.  The JavaScript can then retrieve the XML file, parse it, and update an element of the page, such as a div.

 

Your work flow would be something like this (assuming that a new ad appears every 30 seconds):

 

User loads page ->

start JavaScript timer ->

at 30 seconds trigger a php page which retrieves another ad from a database and creates an XML file ->

use JavaScript to parse the XML file ->

use JavaScript to retrieve values necessary to display new ad, such as a new link and new image or text ->

use JavaScript to update the div in which the ad is displayed ->

reset timer to 0

 

I used to be a fan of AJAX, until I realized that AJAX is not supported by Safari or Chrome.  Maybe there's a way around this, but I don't know of any yet ...

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.