PDA

View Full Version : Conditionals


Wunderlust
02-08-2011, 10:07 PM
Hi,

i have searched but cannot find the conditional to do the following:-

Show an ad after the last post AND also only if there is more than one reply to the thread. Could anyone help me with this?

Thanks

TIm

Lynne
02-09-2011, 12:08 AM
What template are you putting the condition in? If the postbit/_legacy, then I think the variables are $post['postid'] (you want that to not be 1) and $post['islastshown']. So, something like:

<vb:if condition="$post['islastshown'] AND $post['postcount'] != 1">stuff</vb:if>I've not tested it, but I think it's something like that.

Wunderlust
02-09-2011, 10:29 AM
Thx Lynne, I did try that but alas it does not seem to have an affect! I also tried maxposts but to no avail :-(

Lynne
02-09-2011, 02:35 PM
I tried it on my site and it worked just fine. Exactly where are you putting it and can we have a link to a page where it should show up.

Wunderlust
02-09-2011, 10:01 PM
Hi Lynne, I am putting the code right at the bottom of the postbit legacy template.

An example of a thread with no posts is here.. http://www.tacklebox.com.au/forums/fishing-general-chat/623-rods-air-travel.html

I also have another conditional to show the ads after the first post which uses the following:

<vb:if condition="$post[postcount] % $vboptions[maxposts] == 1">
Google Code
</vb:if>


This is just before the conditional that I want to only show one ad if no posts made.

Lynne
02-09-2011, 10:04 PM
Whoops, I'm sorry. I had first written $post['postid'] before doing it on my site and figuring out it was actually $post['postcount']

<vb:if condition="$post['islastshown'] AND $post['postcount'] != 1">stuff</vb:if>

Wunderlust
02-09-2011, 10:22 PM
Wonderful Lynne - you rock! Now to start annew thread on my second problem!