Link to home
Create AccountLog in
Avatar of IRHusker
IRHuskerFlag for United States of America

asked on

Banner(HTML) ad slider

Hello!

I currently display 4 ads(each built with a 1x1 HTML table) on a page when loaded.  They can't be just images in this case.  The ads are random with each page load but I would like to also provide the ability to scroll left and right with arrows on either side.  

The code I currently have is attached.  I am providing it so that you can see what I am currently doing.  It works great, just need to be able to slide left or ride and not just display 4 static ads.

The site uses PHP.

Thanks!
<?php

$displaysProd_dir = ('/includes/displays/products/');
//echo $displaysProd_dir;

$Proddir = new DirectoryIterator($displaysProd_dir);

foreach ($Proddir as $fileProdinfo) {
    if (!$fileProdinfo->isDot() && !$fileProdinfo->isDir() ) {
    	 	
    	$fileProdList[] = $fileProdinfo->getFilename();    	
    }
}
		shuffle($fileProdList);
		$displayProd_file1 = $fileProdList[0];
		$displayProd_file2 = $fileProdList[1];
		$displayProd_file3 = $fileProdList[2];
		$displayProd_file4 = $fileProdList[3];		
		
	//echo ($displaysProd_dir.$displayProd_file1);
?>
<table width="760" border="0" cellspacing="0" cellpadding="0" background="../images/bkg_home-prod.png">
  <tr>
    <td width="182px"><?php include ($displaysProd_dir.$displayProd_file1); ?></td>
    <td width="10px">&nbsp;</td>
    <td width="182px"><?php include ($displaysProd_dir.$displayProd_file2); ?></td>
    <td width="10px">&nbsp;</td>
    <td width="182px"><?php include ($displaysProd_dir.$displayProd_file3); ?></td>
    <td width="10px">&nbsp;</td>
    <td width="182px"><?php include ($displaysProd_dir.$displayProd_file4); ?></td>
  </tr>
</table>

Open in new window

Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

I think you mean a carousel?
ASKER CERTIFIED SOLUTION
Avatar of Sudaraka Wijesinghe
Sudaraka Wijesinghe
Flag of Sri Lanka image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of IRHusker

ASKER

Thanks Sudaraka!
Glad to help. Thanks for the points.