PDA

View Full Version : Banner after First Post


mikeinjersey
04-18-2010, 08:30 PM
Basically all I want to do is have the banner that appears after the first post in each thread (Ad Manager Templates > ad_showthread_firstpost) to go off of the visitor rules in Ad Manager.

Since there is no specific template specified for "ad_showthread_firstpost" in the Ad Manager, I have to use "Header 2" in its place.

Which means I should be able to use the

{vb:raw ad_location.global_header2}

variable somewhere in SHOWTHREAD...so that it only appears after the first post in each thread.

I tried a few places, but couldn't get it to appear after the first post in each thread.

Once again , i'm trying to place this variable in SHOWTHREAD so that it displays a banner after the 1st post in each thread. (and use Header 2 template in its place so that it goes off of the visitor rules from Ad Manager.)

Any idea where exactly to place it ?

Lynne
04-18-2010, 09:13 PM
I don't think what you are trying to do is going to be simple. Have you found the code that defines whether the global_header2 template gets rendered? Where is it (in which php file)? Now you will have to find the code where the ad_showthread_firstpost template is rendered (showthread.php) and replace that code with the other code. You could probably write a plugin using the showthread_postbit_create template to render it. But again, you need to find the other code that renders the ad template, see if you need to include other files to help run the code, and then place it in that plugin you create.

mikeinjersey
04-18-2010, 09:54 PM
Lynn's the best. I've been driving her nuts today.

I don't think what you are trying to do is going to be simple. Have you found the code that defines whether the global_header2 template gets rendered?

I was able to test

{vb:raw ad_location.global_header2}

out and it worked when I added the banner code manually to the Header 2 template in Ad Manager....so that part works. I could stick

{vb:raw ad_location.global_header2}

in any template...and it WILL render / display the banner correctly.



Where is it (in which php file)?


That I dont know...and don't really wanna mess with the pure .php files. Since i'm going to have to overwrite them eventually anyway whenever theres a new update. I'd like to try to keep everything Template based.


You could probably write a plugin


arghh... I'd rather do without any other plugins. I'm surprised this can't be done just through the template. Hopefully VB will let us be 'more free' with choosing our Ad Templates in the next update or so.

Lynne
04-19-2010, 04:03 AM
Have you tried adding it with a condition into the postbit_wrapper template? Or just at the end of the postbit template? <if post=1, then render this also>

mikeinjersey
04-19-2010, 02:24 PM
Have you tried adding it with a condition into the postbit_wrapper template? Or just at the end of the postbit template? <if post=1, then render this also>

Thx for the suggestion. Seems like were kinda heading in the right direction.

I tried both -

<if post=1, then render this also>
{vb:raw ad_location.global_header2}

and

<if post=1 {vb:raw ad_location.global_header2}>

It displayed it after every post though...not just the first one.

Maybe using wrong code ?

Lynne
04-19-2010, 07:45 PM
Um, no. I wasn't actually writing the condition, just verbalizing it. I think it's $post['count']? Not sure, double check it in the template.

<vb:if condition="$post['count'] == 1">
do something
</vb:if>

Something along those lines maybe. You'll have to look up the variable name.

mikeinjersey
04-19-2010, 09:57 PM
<vb:if condition="$post['count'] == 1">
do something
</vb:if>


<vb:if condition="$post['postcount'] == 2">
do something
</vb:if>

Worked.

Thanks much, Lynn. You rock.