Log in

View Full Version : How do I insert an ad after the first post in a thread?


huss
04-04-2001, 07:35 PM
Let's say I want to insert an ad or somesuch in after the first post of every thread. How would you go about doing that?

You would stick it at the bottom of the while loop in showthread that displays the posts.

I've taken a look through the code, and frankly it's beyond me how to do this. I think this is very useful for ad driven sites and was wondering if you could give me more guidance? Or should I ask in hacks?

Wayne Luke
04-05-2001, 04:57 AM
This example uses PHPAds.....

In showthread look for:

eval("\$postbits .= \"".gettemplate("postbit")."\";");


If you only want one ad after the first post put:

if ($counter==1) {
require ("/pathto/phpAds/config.inc.php3");
require ("/pathto/phpAds/view.inc.php3");
require ("/pathto/phpAds/acl.inc.php3");
$postbits .= "<table width=\"{tablewidth}\"><tr><td align=\"center\">".get_view("")."</td></tr></table>";
}


If you want more than one ad say one every 5 posts use this:

if (($counter%5)==0) {
require ("/pathto/phpAds/config.inc.php3");
require ("/pathto/phpAds/view.inc.php3");
require ("/pathto/phpAds/acl.inc.php3");
$postbits .= "<table width=\"{tablewidth}\"><tr><td align=\"center\">".get_view("")."</td></tr></table>";
}

Freddie Bingham
04-05-2001, 05:04 AM
change the require to include as require can do funny things like, oh always require the file even if the code block doesn't execute.

kontrabass
05-07-2001, 03:05 PM
Can I expand this question?: Can the same thing be done in the thread list (ie, insert an ad after the 1st thread in a forum)?

Thanks!

limey
05-08-2001, 01:29 AM
does this code still work?

I tried it on RC2 and it didn't:

thats what I get.
Fatal error: Call to undefined function: get_view()