Support » Plugins » PHP code in Adsense Plugin

  • Aloha,

    I have added Phil Hord’s Adsense plugin to my new blog and would like to use it to display random ads from Adsense and others.

    I’m thinking that I should be able to add some PHP code to the Adsense section in the plugin file, but it doesn’t want to execute my code 🙁

    I have added the following code:
    $adsense_code = '
    <!-- Begin Google Adsense code -->
    CODE1
    <phpcode>
    <?php
    srand(time());
    $random = (rand()%9);
    print("Random is: $random");
    CODE2
    ?>
    </phpcode>
    <!-- End Google Adsense code -->
    ';

    This displays CODE1 in my posts, but not the random number and CODE2. I have installed PHP Exec in my attempt to make it work, but that didn’t change anything.

    Thanks,
    PhiMix

  • The topic ‘PHP code in Adsense Plugin’ is closed to new replies.