I was updating to the latest version and all went quickly as I have all code mods as plugins. But I still had to fix modded templates one by one. I noticed the template_hooks and thought I might be able to save myself some time in the future by using some of these. So I decided I could try this out on my postbit_legacy template where I have this code at the end to display an ad after the first post:
HTML Code:
<if condition="!$GLOBALS['FIRSTPOSTID']">
<br>
<table id="post$post[postid]" class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="100%" align="center">
<tr>
<td class="thead" style="font-weight:normal; border: $stylevar[cellspacing]px solid $stylevar[tborder_bgcolor]" colspan="2">
Sponsored Links
</td>
</tr>
<tr>
<td class="alt2" style="border: $stylevar[cellspacing]px solid $stylevar[tborder_bgcolor]; border-top: 0px">
<Ad code goes here>
</td>
</tr>
</table>
</if>
I figured I could use the $template_hook[postbit_end] hook to do this. I took the code above and put it into a template called custom_postbit_ad_at_end and created this plugin:
Code:
eval('$template_hook[postbit_end] .= " ' . fetch_template('custom_postbit_ad_at_end') . '";');
I didn't know what hook location to use so I've tried everything from global_start to showthread_start to ???
My problem is that it shows the ad after every post, not just the first. So I'm guessing that my conditional is coming up TRUE every time because $GLOBALS['FIRSTPOSTID'] is empty every time. Can somebody throw me a clue as to what I'm doing wrong? Is there a way to make this work? Seemed like it should be simple, but....
Thanks