Banner Rotation Help

Discussion in 'PHP' started by powerlifer, Jan 18, 2009.

  1. #1
    Hey guys i could do with some help. As you can see from this site http://www.champlegals.co.uk

    What im trying to setup is ads that refresh across from my banner.

    I found a script and it works manually but the php includes doenst seem to be coming up.

    Also i dont want it centered how can i get it across from my logo, ive entered the include there.

    this is the script:
    <?php
    srand ((double) microtime( )*1000000);
    $numbanners = 2;
    $banner = rand(0,$numbanners);
    echo "<table align=center class=maincats bgcolor=white width=468><tr><td>";
    include ("./banners/$banner.html");
    echo "</td></tr></table>";
    ?>
    Code (markup):
    and this the php include:

    <?php include("http://www.champlegals.co.uk/revolver/banners.php"); ?>

    If you go to the link you'll see it works although it is centered which i dont wnat.

    Anyhelp is appreciated:)
     
    powerlifer, Jan 18, 2009 IP
  2. rjd22

    rjd22 Peon

    Messages:
    63
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    <?php
    srand ((double) microtime( )*1000000);
    $numbanners = 2;
    $banner = rand(0,$numbanners);
    echo "<table class=maincats bgcolor=white width=468><tr><td>";
    include ("./banners/$banner.html");
    echo "</td></tr></table>";
    ?>
    
    PHP:
    It should work that way since when I got to www. champlegals.co.uk/revolver/banners.php I can see the banner
     
    rjd22, Jan 18, 2009 IP
  3. powerlifer

    powerlifer Active Member

    Messages:
    2,002
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    78
    #3
    Yeah lik i say when you go to the address you say it works fine.

    But it doesnt seem to otherwise, any ideas man?
     
    powerlifer, Jan 18, 2009 IP
  4. khan11

    khan11 Active Member

    Messages:
    615
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #4
    try this.
    
    <?php
    srand ((double) microtime( )*1000000);
    $numbanners = 2;
    $banner = rand(0,$numbanners);
    echo "<table class=maincats bgcolor=white align=right width=468><tr><td>";
    include ("http://www.champlegals.co.uk/revolver/banners.php");
    echo "</td></tr></table>";
    ?>
    
    PHP:
    edited the url
     
    khan11, Jan 18, 2009 IP
  5. powerlifer

    powerlifer Active Member

    Messages:
    2,002
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    78
    #5
    Still not working sadly thanks for your help though.

    Must be something to do with that php include.
     
    powerlifer, Jan 18, 2009 IP
  6. powerlifer

    powerlifer Active Member

    Messages:
    2,002
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    78
    #6
    This is very confusing everyone seems to be stumped.

    Its meant to be such as simple script too.
     
    powerlifer, Jan 18, 2009 IP
  7. khan11

    khan11 Active Member

    Messages:
    615
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #7
    sorry, for posting useless code.

    Use this code in your banners file
    
    <?php
    srand ((double) microtime( )*1000000);
    $numbanners = 2;
    $banner = rand(0,$numbanners);
    echo "<table class=maincats bgcolor=white align=right width=468><tr><td>";
    include ("./banners/$banner.html");
    echo "</td></tr></table>";
    ?>
    
    PHP:
    include this file using the correct path like:
    if you want to include on main page, use this code:

    <?php include("revolver/banners.php"); ?>

    and if you want to put banner on other file like on some sub directory, use this

    <?php include("../revolver/banners.php"); ?>
     
    khan11, Jan 18, 2009 IP
  8. powerlifer

    powerlifer Active Member

    Messages:
    2,002
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    78
    #8
    hey mate sadly its still not working with those updated additions.

    My source code can be checked and im using the php include and ive updated the banner file.

    This is confusing.

    Appreciate your time again thanks.
     
    powerlifer, Jan 18, 2009 IP
  9. khan11

    khan11 Active Member

    Messages:
    615
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #9
    i caught your error mate, you're trying to include this thing in some other extension file, like something .tpl or etc..

    thats why it is not working.

    You should add this on some .php page.

    Php code cannot be seen in source code.

    EDITED:
    check this link, it will help you on how to do it. LINK
     
    khan11, Jan 18, 2009 IP
  10. powerlifer

    powerlifer Active Member

    Messages:
    2,002
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    78
    #10
    But i need it across from the banner so will this not work?

    And if so where could i find a workable script that i can add any javascript, image code etc.
     
    powerlifer, Jan 18, 2009 IP
  11. rjd22

    rjd22 Peon

    Messages:
    63
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #11
    I may have a script that I found long ago let me search for it

    EDIT:
    Found it here it is.
     

    Attached Files:

    rjd22, Jan 18, 2009 IP
  12. powerlifer

    powerlifer Active Member

    Messages:
    2,002
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    78
    #12
    Just seen your link nice one man thanks.

    So do i just add the php include to make a plugin?

    Cheers again
     
    powerlifer, Jan 18, 2009 IP
  13. powerlifer

    powerlifer Active Member

    Messages:
    2,002
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    78
    #13
    If i had any money id be willing to pay someone to show me how to make the plugin that matches my script.

    I just tried but cant make head nor tail of it.
     
    powerlifer, Jan 18, 2009 IP
  14. rjd22

    rjd22 Peon

    Messages:
    63
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #14
    I added the banner script in the previous post Now you don't have to make a include you just have the request the script in a image tag. The bannerscript acts like he is a image
     
    rjd22, Jan 18, 2009 IP
  15. powerlifer

    powerlifer Active Member

    Messages:
    2,002
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    78
    #15
    Will that work with some javascript ads, and normal image ads?

    EDIT: I dont think that script will work as it has no place to put the ad links or the javascript ads, thanks anyway.

    Still looking for some help creating a plugin for my script.
     
    powerlifer, Jan 18, 2009 IP
  16. rjd22

    rjd22 Peon

    Messages:
    63
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #16
    it the best you can get atm. The only way to get it working now is to modify it. since you can't use PHP in the templates.
     
    rjd22, Jan 18, 2009 IP
  17. powerlifer

    powerlifer Active Member

    Messages:
    2,002
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    78
    #17
    I have no php knowledge or i would thanks anyway.

    Im sure how to make a plugin to match my script is very simple but again have no knowledge.
     
    powerlifer, Jan 18, 2009 IP
  18. fatedesign

    fatedesign Peon

    Messages:
    38
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #18
    <?php
    $ran = rand(1, 5);
    $link = yourpagehere.$ran;
    $img = images\yourbannerhere.$ran;
    echo "<html><head></head><body><a href=\"$link\"><img src=\"$img\" boder=\"0\"></a></body></html>";
    ?>

    there ya go bro
     
    fatedesign, Jan 18, 2009 IP