MyBB Community Forums

Full Version: Inline Ads (between posts adsense, ypn, or chitika)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
^^^

Same problem here. I can't read German, so I gave up trying to find the differences in their code. Both are great mods though. Thanks!
i just intsalledlabroccas mod and it works very fine
Is it possible to use PHP in the box where you ad your HTML? I want to rotate some ads, and I have a php script to do this.

Here is the script:
<?php
	$fcontents = join ('', file ('verts.txt')); // change 'verts.txt' to your ad file
	$s_con = split("~",$fcontents);
	$banner_no = rand(0,(count($s_con)-1));
	echo $s_con[$banner_no];
	?>

Then you just create a .txt file with the HTML for the various ads you want, separated by the tilde. The .txt file needs to be in the same folder as the code, I assume that would be inc/plugins/ folder, right?
You can try it but I am pretty sure it won't work. What you should do is this...

1. Save that php as a file...maybe addisplay.php
2. Create an iframe tag to inlude the addisplay.php into the inline ads position.

That should work just fine.
labrocca Wrote:You can try it but I am pretty sure it won't work. What you should do is this...

1. Save that php as a file...maybe addisplay.php
2. Create an iframe tag to inlude the addisplay.php into the inline ads position.

That should work just fine.

Great idea! Thanks! I'll let you know how that works in just a bit.
Perfect! That worked perfectly!

Using the php code above and an iFrame, I got exactly what I needed!

Thanks!

Guess I should elaborate a bit:
Here is the php rotator I'm using to display HTML banner ads and Javascript ads at random:

    <?php
    $fcontents = join ('', file ('adverts.txt')); //change 'adverts.txt' to the name of your file
    $s_con = split("~",$fcontents);
    $banner_no = rand(0,(count($s_con)-1));
    echo $s_con[$banner_no];
    ?>
In addition to the php code, you'll need a .txt doc with the HTML code for your ads, each ad needs to be separated from the next with a '~' tilde (minus quotes).

So, your .txt would look similar to this:

<a href="http://www.YourSponsor.com/"><img src="http://www.YourAdImage.com/"></a>
~
<a href="http://www.YourSponsor.com/"><img src="http://www.YourAdImage.com/"></a>
~
<a href="http://www.YourSponsor.com/"><img src="http://www.YourAdImage.com/"></a>
~
<a href="http://www.YourSponsor.com/"><img src="http://www.YourAdImage.com/"></a>

Ad the PHP to your site, wherever you want ads to show up. Then whenever that page is refreshed it will grab an ad at random from your .txt file. If you are using a forum software that will allow you to put inline ads using HTML, but not PHP, just make the PHP code it's own file, and use an iFrame to call it.

You can see an example of this on my forum: http://wiipoint.net/forum

I've got it set up for the inline ads. So just choose any topic and you will see one of the ads after the first post and each 10th post.
ironcannibal Wrote:Perfect! That worked perfectly!

Using the php code above and an iFrame, I got exactly what I needed!

Thanks!

Guess I should elaborate a bit:
Here is the php rotator I'm using to display HTML banner ads and Javascript ads at random:

    <?php
    $fcontents = join ('', file ('adverts.txt')); //change 'adverts.txt' to the name of your file
    $s_con = split("~",$fcontents);
    $banner_no = rand(0,(count($s_con)-1));
    echo $s_con[$banner_no];
    ?>
In addition to the php code, you'll need a .txt doc with the HTML code for your ads, each ad needs to be separated from the next with a '~' tilde (minus quotes).

So, your .txt would look similar to this:

<a href="http://www.YourSponsor.com/"><img src="http://www.YourAdImage.com/"></a>
~
<a href="http://www.YourSponsor.com/"><img src="http://www.YourAdImage.com/"></a>
~
<a href="http://www.YourSponsor.com/"><img src="http://www.YourAdImage.com/"></a>
~
<a href="http://www.YourSponsor.com/"><img src="http://www.YourAdImage.com/"></a>

Ad the PHP to your site, wherever you want ads to show up. Then whenever that page is refreshed it will grab an ad at random from your .txt file. If you are using a forum software that will allow you to put inline ads using HTML, but not PHP, just make the PHP code it's own file, and use an iFrame to call it.

You can see an example of this on my forum: http://wiipoint.net/forum

I've got it set up for the inline ads. So just choose any topic and you will see one of the ads after the first post and each 10th post.

This seems like it is just what I need. I'm trying to add it to my header, but I can't get the IFrame to work. Any ideas?

Thanks and best wishes,
Kristen
Post your iframe code.
labrocca Wrote:Post your iframe code.

What an angel you are to respond so quickly.  This could very well be the problem, as I've never used an iFrame before.  

Here's what my new heading information looks like.  All I've added is the <div style="float"... </div> section.  I am also using a free temporary hosting until I get the forums looking the way they want, which I think might also be the problem.  I actually got it to show up, but I need to adjust the size somehow.

My forum is located at www.anthempages.com/forum

Any help you can offer would be appreciated.  I am very new at this (having only done html before) and I'm trying to learn.  So please forgive any ignorance on my part.  The spacing is aligned with the other <div> tags below it if that makes a difference (somehow I'm not getting them to show up correctly here.)

Thanks and best wishes,
Kristen

<a name="top" id="top"></a>
	<div id="container">
		<div id="header">
			<div style="float: right;"><iframe src="http://www.anthempages.com/forum/ads/addisplay.php"></iframe>
			</div>
			<div class="logo"><a href="{$mybb->settings['bburl']}/index.php"><img src="{$theme['logo']}" alt="{$mybb->settings['bbname']}" /></a></div>
			<div class="menu">
				<ul>
					<li><a href="{$mybb->settings['bburl']}/search.php"><img src="{$theme['imgdir']}/toplinks/search.gif" alt="" />{$lang->toplinks_search}</a></li>
					<li><a href="{$mybb->settings['bburl']}/memberlist.php"><img src="{$theme['imgdir']}/toplinks/memberlist.gif" alt="" />{$lang->toplinks_memberlist}</a></li>
					<li><a href="{$mybb->settings['bburl']}/calendar.php"><img src="{$theme['imgdir']}/toplinks/calendar.gif" alt="" />{$lang->toplinks_calendar}</a></li>
					<li><a href="{$mybb->settings['bburl']}/misc.php?action=help"><img src="{$theme['imgdir']}/toplinks/help.gif" alt="" />{$lang->toplinks_help}</a></li>
				</ul>
			</div>
			<hr class="hidden" />
			<div id="panel">
				{$welcomeblock}
			</div>
		</div>
		<hr class="hidden" />
		<br class="clear" />
		<div id="content">
			{$bannedwarning}
			{$bbclosedwarning}
			{$unreadreports}
			{$boardmsg}
			{$unreadpmmsg}
			{$unreadpmmsg}
			<navigation>
			<br class="clear" />	
You know, I think I figured it out, so I'm sorry to have bothered you. Of course, if you have any advice you want to share, please do.

A couple of silly mistakes and then I think I just need to get rid of the ad-based hosting and I'll be good.

Thanks again and best wishes,
Kristen
Pages: 1 2 3 4