MyBB Community Forums

Full Version: Can I put My Ads in any Include file?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to put my google ads in a file : myads.php
and i want to include it in Index_stats

so is it possible to do with this code:

<?php include(myads.php); ?>

This will Include the file in index_stats

or any Good Tip to Include Ads in Posts or in Community?
Doesn't google ads come in plain HTML and Javascript? You can enter HTML and Javascript into the template.

If you still need PHP, then you can do something like this.

In index.php, after <?php paste this in:
ob_start();
include('myads.php');
$my_ads = ob_get_clean(); 

Then use $my_ads in the index_stats template.
DennisTT Wrote:Doesn't google ads come in plain HTML and Javascript? You can enter HTML and Javascript into the template.

If you still need PHP, then you can do something like this.

In index.php, after <?php paste this in:
ob_start();
include('myads.php');
$my_ads = ob_get_clean(); 

Then use $my_ads in the index_stats template.

Thanks!
Nice Info.
what does it do " ob_get_clean(); "

I have to Include this variable " $my_ads " where I want to see my ads? right?
cheers
bitslinker.com Wrote:
DennisTT Wrote:Doesn't google ads come in plain HTML and Javascript? You can enter HTML and Javascript into the template.

If you still need PHP, then you can do something like this.

In index.php, after <?php paste this in:
ob_start();
include('myads.php');
$my_ads = ob_get_clean(); 

Then use $my_ads in the index_stats template.

Thanks!
Nice Info.
what does it do " ob_get_clean(); "
The ob_start() creates an output buffer. That is, whatever output the script has, it will not be shown to the user. ob_get_clean() gets the content from this buffer into a variable which you use in your template.

Quote:I have to Include this variable " $my_ads " where I want to see my ads? right?
cheers

Yes that is correct.