I have never used php before however managed to install the script and setup the database tables for an open source script. So please excuse my lack of jargon.
Currently a list of text ads that our output, and it can show all (which I want), however this means that it could potentially list 100 adds horizontally, without moving to the next line after X ads r X pixels.
Example at: http://www.beneficialads.com/adview....00&direction=h
How can I get it to move to the next line after X ads or X pixels, or some way so it doesn't just keep on going horizontally?
Thanks in advance - if anyone can help :-S
Code for that section is below:
Currently a list of text ads that our output, and it can show all (which I want), however this means that it could potentially list 100 adds horizontally, without moving to the next line after X ads r X pixels.
Example at: http://www.beneficialads.com/adview....00&direction=h
How can I get it to move to the next line after X ads or X pixels, or some way so it doesn't just keep on going horizontally?
Thanks in advance - if anyone can help :-S
Code for that section is below:
Code:
function displayAds ($dbDatabase, $adsNum, $adsDirection, $adsWidth, $adsHeight)
{
$adsNum = (int) $adsNum;
$adsDirection = substr($adsDirection, 0, 1);
$adsWidth = (int) $adsWidth;
$adsHeight = (int) $adsHeight;
if ($adsNum>5)
{
$adsNum = 1000000;
} // For safety
$clickURL = "http://".$_SERVER["HTTP_HOST"].str_replace("adview","adclick",$_SERVER["SCRIPT_NAME"]);
echo "<script> function tpadstat(id) { var tpadImg = new Image(); tpadImg.src =('".$clickURL."?id='+id) } </script>";
// Read ads
$sql = "SELECT id,title,line1,line2,hyperlink FROM ".$dbDatabase.".tpad_ads ".
"WHERE deleted=0 ".
"AND (expires>=now() OR expires IS NULL) ".
"AND (clicks<maxclicks OR maxclicks IS NULL) ".
"AND (views<maxviews OR maxviews IS NULL) ".
"ORDER BY rand() ".
"LIMIT ".$adsNum;
echo "<table cellspacing=0 cellpadding=2 width=$adsWidth height=$adsHeight>";
if ($adsDirection=="H")
{
echo "<tr>";
}
$result = mysql_query ($sql);
while (list ($_id, $_title, $_line1, $_line2, $_hyperlink) = mysql_fetch_array($result))
{
// Display ad
echo ($adsDirection=="V") ? "<tr><td nowrap>" : "<td nowrap>";
echo parseAd ($_id, $_title, $_line1, $_line2, $_hyperlink);
echo ($adsDirection=="V") ? "</td></tr>" : "</td>";
// Write stats
$sql = "UPDATE ".$dbDatabase.".tpad_ads SET views=views+1 WHERE id='".$_id."'";
@mysql_query ($sql);
$sql = "INSERT INTO ".$dbDatabase.".tpad_stats SET ad='".$_id."',date=now()";
@mysql_query ($sql);
$sql = "UPDATE ".$dbDatabase.".tpad_stats SET views=views+1 WHERE ad='".$_id."' AND date=now()";
@mysql_query ($sql);
}
if ($adsDirection=="H")
{
echo "</tr>";
}
echo "<tr><td colspan=10 align=right><a href=\"adnew.php\" target=_blank>";
echo "<font style=\"font-size: 7pt\">Your Beneficial Ad here?</font></a></td></tr>";
echo "</table>";
}
if ($_GET["num"])
{
$adsNum = $_GET["num"];
}
if ($_GET["direction"])
{
$adsDirection = $_GET["direction"];
}
if ($_GET["width"])
{
$adsWidth = $_GET["width"];
}
if ($_GET["height"])
{
$adsHeight = $_GET["height"];
}
displayAds ($dbDatabase, $adsNum, $adsDirection, $adsWidth, $adsHeight);
?>
Comment