[Register]
Powered by Elgg

Plugins :: Blog :: Advertiser Plug-In

October 09, 2007

Hoping someone might help me in how to add a PHP 'include' in the Advertiser Plug-In, so I can rotate some random ads?

I'm not a PHP person, but I think the 'END' block or the three 'less-than' angle brackets (heredoc?) stops PHP being intepreted (code gets ignored)?

Wanted to use the 'Simple Ad Rotator' from PHPBuddy:
http://www.phpbuddy.com/article.php?id=4

Thanks

Keywords: Advertiser Plug-In

Posted by rpr @ Plugins


Comments

  1. After END; you can add the code (banner_ads.txt must be in the same directory):


    $fcontents = join ('', file ('banner_ads.txt'));
    $s_con = split("~",$fcontents);

    $banner_no = rand(0,(count($s_con)-1));
    $run_result .= $s_con[$banner_no];

    user iconRolando Espinoza La Fuente on Tuesday, 09 October 2007, 18:10 UTC # |

  2. Thanks for your help Rolando.

    Your suggestion put the Adverts at the very top of the page (above LogIn toolbar)? But that got me started and I seem to have got it working by getting rid of the 'END' block altogether. Hope that isn't going to cause problems with anything else?

    Thanks again
    RPR.

    user iconrpr on Tuesday, 09 October 2007, 19:28 UTC # |

You must be logged in to post a comment.

Site supported by Curverider Ltd - powered by the awesome Elgg