Announcement

Collapse
No announcement yet.

Can I add a 'rotating' sponsor banner to my Forum?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • petermw
    replied
    Anyway, to get rid of the border around the ad images and make the target url open in a new window? Otherwise a great script! thanks!

    P

    Leave a comment:


  • ghostdog
    replied
    Originally posted by Visionray
    jdearing.

    I get everything you said in the first part...but what do you mean by

    "In phpparsedcode portion ad this:

    $myad = implode('', file("http://www.domain.com/rotator.php"));

    and in header section ad
    $myad " ?

    What is phpparsedcode? Sorry Im a newbie and I am having the same problems as esawdust. Do I add the first portion in the page Im calling the php with? or do I add that code in the rotator.php file? And where in the page do I add that?

    Thanks
    Refering to your admin control panel.

    Leave a comment:


  • Visionray
    replied
    jdearing.

    I get everything you said in the first part...but what do you mean by

    "In phpparsedcode portion ad this:

    $myad = implode('', file("http://www.domain.com/rotator.php"));

    and in header section ad
    $myad " ?

    What is phpparsedcode? Sorry Im a newbie and I am having the same problems as esawdust. Do I add the first portion in the page Im calling the php with? or do I add that code in the rotator.php file? And where in the page do I add that?

    Thanks

    Leave a comment:


  • jdearing
    replied
    I had to modify their code just a little to get it to work on my site. The problem I was having was the images not showing up. I had to change the \ between $folders and $images in the next to the last line to a /

    I also added a couple things to get rid of the border around the ad and a _new on the link to make it open in a new window!


    <?php
    $folder = "http://www.stlracing.com/banner"; //your images folder no trailing slash

    $images = array("1" => "adhere.gif", "2" => "web-hosting.gif");

    $link = array("1" => "www.stlracing.com/ad.php", "2" => "www.stlracing.com/webhost-rates.php"); //where you want to send them

    $ads = "2"; //the number of images you have

    $num = rand(1, $ads);

    echo "<a href=\"http://$link[$num]\" target=\"_new\"><img src=\"$folder/$images[$num]\" border=\"0\"></a>";

    ?>


    In phpparsedcode portion ad this:

    $myad = implode('', file("http://www.domain.com/rotator.php"));

    and in header section ad
    $myad
    Last edited by jdearing; Fri 21st Dec '01, 6:42pm.

    Leave a comment:


  • Goldfinger
    replied
    i dont know what isnt working for you. I tested this on my server and it works wonderfully. What are your server specs?

    Leave a comment:


  • esawdust
    replied
    Downloaded the file to ovewrite my existing... changed my images directory to the proper and the image names. Still no luck. Can I possibly see some code where it is implemented and working? If I could at least get it come up on the screen I could work on the placement.

    Thanks

    Greg

    Leave a comment:


  • Goldfinger
    replied
    forgot to add the file.

    Leave a comment:


  • Goldfinger
    replied
    here try this one .

    Leave a comment:


  • esawdust
    replied
    Hi Goldfinger,

    Thanks for your reply. I tried your suggestion with no luck. Here is how I inserted it into the header template. Maybe you or someone can see if something is wrong.

    <!-- logo and buttons -->
    <center>
    <table border="0" width="{tablewidth}" cellpadding="0" cellspacing="0">
    <tr>
    <td valign="top" align="left" background="{imagesfolder}/menu_background.gif"><a
    href="http://www.esawdust.com?s=$session[sessionhash]"><img src="{titleimage}" border="0" alt="$bbtitle"></a></td>
    <td valign="bottom" align="right" nowrap background="{imagesfolder}/menu_background.gif">
    <td valign="top" align="right">
    <? include('rotator.php');?>
    <!-- toplinks -->
    <a href="usercp.php?s=$session[sessionhash]"><img src="{imagesfolder}/top_profile.gif" alt="Here you can view your subscribed threads, work with private messages and edit your profile and preferences" border="0"></a>

    Im kinda at a loss here... not sure what is wrong. Here is my modified Rotator.php file. Both banners are in the images directory listed below.

    <?php
    <?php
    $folder = "http://www.esawdust.com/forums/images"; //your images folder no trailing slash

    $images = array("1" => "readysealbanner.jpg", "2" => "esawdust.jpg"); //all your images seperated by a comma.

    $link = array("1" => "www.readyseal.com", "2" => "www.esawdust.com"); //where you want to send them

    $ads = "2"; //the number of images you have

    $num = rand(1, $ads);

    echo "<a href=\"http://$link[$num]\"><img src=\"$folder\$images[$num]\"><a>";

    ?>

    Thanks again!

    Greg

    Leave a comment:


  • Goldfinger
    replied
    try putting in the full path to in the include not the url the full path from the server. Also make sure you change the image directory to your images folder (url this time).

    <? include('/home/username/whatever/rotator.php'); ?>

    Leave a comment:


  • esawdust
    replied
    -------------------------------------------------------------------------------


    just save this as rotator.php in notepad , upload and call it where you want it to be..

    <? include('rotator.php'); ?>

    change the images to your images

    ---------------------------------------------------------------------------------

    Hi ,

    I am trying to install this and having a few problems... sorry Im a novice!! Saved php file as rotator.php in the forums directory and I am attempting to call it in the header template (above the buttons)

    Is the <?include('rotator.php'); ?> all you have to enter or do I need to specify a directory?

    my ad banner directory is http://www.esawdust.com/forums/ads
    and the rotator.php is saved within the forums directory with the rest of the php files.

    I made 2 default test banners and saved them to my ads directory- place the include code in the header above the usercp button code but I am not getting anything.

    I really appreciate the help!

    Happy Holidays
    Greg

    Leave a comment:


  • tubedogg
    replied
    Sure is.

    Leave a comment:


  • Nikhil Nayak
    replied
    Thanks Goldfinger! I've been wanting to do this on my site for a while. PHP is amazing ...

    nik

    Leave a comment:


  • Goldfinger
    replied
    PHP Code:
    <?php
    $folder 
    "http://www.mysite.com/images"//your images folder no trailing slash

    $images = array("1" => "image1.gif""2" => "image2.gif"); //all your images seperated by a comma.

    $link = array("1" => "www.asdf.com""2" => "www.yahoo.com"); //where you want to send them

    $ads "2"//the number of images you have

    $num rand(1$ads);

    echo 
    "<a href=\"http://$link[$num]\"><img src=\"$folder\$images[$num]\"><a>";



    ?>
    just save this as rotator.php in notepad , upload and call it where you want it to be..

    <? include('rotator.php'); ?>

    change the images to your images


    [edit] Tested the code and fixed it . it works [/edit]
    Last edited by Goldfinger; Thu 20th Dec '01, 8:42pm.

    Leave a comment:


  • DJRoppolo
    replied
    Re: Can I add a 'rotating' sponsor banner to my Forum?

    I use this simple Java script.. :

    <script LANGUAGE="JavaScript">

    var NumberOfAds =1;
    var now = new Date()
    var sec = now.getSeconds()
    var AdNumber = sec % NumberOfAds;
    AdNumber +=1;


    if (AdNumber==1)

    {

    url="target.url.here";
    Graphic="image.url.here";
    width = "494"
    height = "76"
    }

    document.write('<center>');
    document.write('<a href=\"' + url + '\">');
    document.write('<img src=\"' + Graphic + '\" width=')
    document.write(width + ' height=' + height + ' ');
    document.write('border=0><br>');
    document.write('</a>');
    document.write('</center>');

    </script>

    Leave a comment:

Related Topics

Collapse

Working...
X