Hoping this should be a simple one, just can't find the solution in Google.
I want to show at ad unit at the top, middle and bottom of each forum topic.
My forum shows 10 replies per topic, and to achieve this at the moment I have an ad at the top, in the template I'm using...
IF postrow.S_ROW_COUNT == 4
... to show the ad in the middle. And I have an at the bottom.
When a most has many replies this works perfect, the problem is when a post has 4 replies, the 'middle' and 'bottom' add show directly above/below each other because there aren't enough replies to create space between them.
It's just a bit of a crappy user experience to see 2 ads in a row.
What I'm trying to do is still show the 'middle' add after the 4th reply, but only show it if there have been more than say 8 replies on that page.
I would want this to flow onto subsequent pages with pagination too.
I'm assuming there is something along the lines of "if replies on page = great than X" type variable but I can't find it.
The problem with that is if there are 6,7,8 or 9 replies the banner doesn't show.
On shorter posts the bottom banner will not show at all and I will lose revenue. The top and bottom banners are the best performers, hiding the bottom one at any time is not a suitable solution.
I need a conditional statement on number of replies to be applied to middle banner only, as per my question.
As per /docs/coding-guidelines.html which came with your installation and lists all operators and all loop variables you can do this to avoid displaying it when the 4th post is the last post:
IF ( ( postrow.S_ROW_COUNT == 4 ) and ( not postrow.S_LAST_ROW ) )
But since /viewtopic.php also emits S_NUM_POSTS (which is also used in /styles/prosilver/template/viewtopic_body.html) you could also use that one in i.e. this way:
IF ( ( postrow.S_ROW_COUNT == 4 ) and ( S_NUM_POSTS >= 6 ) )
Both untested.
"The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20 ↑
"But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10 ↑
"My reaction is not to everyone, especially to you." Raptiye, 2021-02-28 ↑