Page 1 of 1

phpNuke and adding an ad box

Posted: Tue May 16, 2006 8:15 am
by tweaker
I'd like to incorporate an ad box to my phpNuke site but I don't want one of those annoying "it pops up all the freaking time" type.

I have a sample code:

Code: Select all

<?php
function place_ad( $title )
{
?>
<div class="ad-box" id="ad">
<div class="ad-box-title">
<?php echo( $title ); ?>
</div>
<p>
MTGO TRADERS is Sponsoring DarkWars
$8 Certificate for 1st place!

Format  FFA ( check site for format)
8:00pm eastern start time

event website:
http://www.taylormadeparties.com/DarkWars.html
-------------------------------------------------------------------------------
</p>
<p style="text-align: right;">
<a href="javascript:closead();">close</a>
</p>
</div>
<?php
}
?>
<html>
<head>
<title>Ad box demonstration</title>
<style>
body {
  width: 800px;
}
.ad-box {
  background: #eee;
  border: 1px solid black;
  padding: 5px;
  position: absolute;
  left: 50px;
  top: 50px;
  width: 600px;
}
.ad-box-title {
  background: #ccc;
  padding: 5px;
  font-weight: bold;
  font-size: large;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}
</style>
<script>
function closead()
{
  var obj = document.getElementById( "ad" );
  obj.style.visibility = "hidden";
}
</script>
</head>
<body>
<?php place_ad( "Today's Event!" ); ?>
<p>This is our event calendar.</p>
</body>
</html>
But what I'd like it to do is actually something a little smarter.

1) I only want it to do this one time a day. That's first and foremost.
2) I'd like to be able to somehow control the information that goes into the ad and see:
A) Who clicks to read more
B) Number of Views

I also want to be able to put this litterally anywhere on my site. I don't want to be stuck with it being on the home page.

Any idea how I could easily do this?

Re: phpNuke and adding an ad box

Posted: Tue May 16, 2006 9:27 am
by someberry
tweaker wrote:
But what I'd like it to do is actually something a little smarter.

1) I only want it to do this one time a day. That's first and foremost.
2) I'd like to be able to somehow control the information that goes into the ad and see:
A) Who clicks to read more
B) Number of Views

3)I also want to be able to put this litterally anywhere on my site. I don't want to be stuck with it being on the home page.

Any idea how I could easily do this?
1) Either set a cookie on the users machine which is deleted after 24 hours, or isert their IP address / username into a database and then truncate it every 24 hours.

2) A) To find out who clicked it, make it go to one of your pages first and then redirect to the advertisers site. Easiest way is probably to store the list of advertisers in a seperate table then refer to their unique ID number with the link to your page. Whilst on that page, see if the ID number is valid, if it is then increment the sites clicks and then add detals of that click into a seperate table, storing name, time, IP address, sex, gender, birthplace (:P) etc. Then forward to the address the advertisers have in their database entry.

2) B) Erm, just retrieve the number of clicks from the advertisers table, simple.

3) Make all of the ouputtable content into an object, and then call that object, simple.

Code: Select all

class Advertisers
{
   // Bla bla bla

   function return_code()
   {
      return $this -> code;
   }
}

$ad_code = new Advertisers();
echo($ad_code -> return_code());

Posted: Sun May 21, 2006 5:49 pm
by tweaker
Not to sound like a total choob but how's the easiest way to use this cookie? Use a new one or use the same one for the site?