Show content if number of replies in topic greater than X

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Scam Warning
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
gerg0123
Registered User
Posts: 5
Joined: Mon Jul 25, 2016 2:21 am

Show content if number of replies in topic greater than X

Post by gerg0123 »

Hi guys,

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.
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 51682
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Show content if number of replies in topic greater than X

Post by stevemaury »

Use another conditional statement to not show the bottom add unless the postrow count is 10.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
gerg0123
Registered User
Posts: 5
Joined: Mon Jul 25, 2016 2:21 am

Re: Show content if number of replies in topic greater than X

Post by gerg0123 »

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.
gerg0123
Registered User
Posts: 5
Joined: Mon Jul 25, 2016 2:21 am

Re: Show content if number of replies in topic greater than X

Post by gerg0123 »

Someone from the brain trust here must know this :D
User avatar
AmigoJack
Registered User
Posts: 5799
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Show content if number of replies in topic greater than X

Post by AmigoJack »

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:

Code: Select all

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:

Code: Select all

IF ( ( postrow.S_ROW_COUNT == 4 ) and ( S_NUM_POSTS >= 6 ) )
Both untested.
  • The worst thing about censorship is ███████████
  • "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
Locked

Return to “[3.0.x] Support Forum”