Counting Posts in the viewtopic_body ...

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Suggested Hosts
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
jmueller0823
Registered User
Posts: 83
Joined: Wed Dec 29, 2004 3:49 pm

Counting Posts in the viewtopic_body ...

Post by jmueller0823 »

We would like to insert banner code mid-page, on a view topic page.

Obviously, we could insert code after each postrow, but that would be overkill.

The criteria might be:

1. If there are 5 or more posts on the page,
2. Insert the code after the 3rd post

Do those types of tags exist? Thanks.

Something like...
<!-- IF total-posts > 5 and postrow = 3 -->
code here
<!-- ENDIF -->
User avatar
ric323
Former Team Member
Posts: 22910
Joined: Tue Feb 06, 2007 12:33 am
Location: Melbourne, Australia
Name: Ric
Contact:

Re: Counting Posts in the viewtopic_body ...

Post by ric323 »

Start with this article: Knowledge Base - Advertisements in phpBB3

and this one: http://wiki.phpbb.com/Template_Syntax

and have a look through ./includes/template.php to see how the variables are assigned, where you will see S_ROW_COUNT will be useful.

(Note, this is just from a quick look at the code myself, I haven't tried this.)
The Knowledge Base contains solutions to many common problems!
How to fix "Doesn't have a default value" and "Incorrect string value: xxx for column 'post_text' " errors.
How to do a clean re-install of the latest phpBB3 version.
Problems with permissions? Read phpBB3 Permissions
jmueller0823
Registered User
Posts: 83
Joined: Wed Dec 29, 2004 3:49 pm

Re: Counting Posts in the viewtopic_body ...

Post by jmueller0823 »

Okay, thanks.

After some research, this is what I have:

``````````````````````````````
viewtopic_body

<!-- BEGIN postrow -->
<!-- IF S_NUM_POSTS > 9 and S_ROW_COUNT == 4 -->
ad markup
<!-- ENDIF -->

``````````````````````````````

And it's not working.

What I'm looking for is this:
1. If there are more than 9 posts on the page,
2. Insert the ad code at the 4th post

Help anyone? Thanks.
jmueller0823
Registered User
Posts: 83
Joined: Wed Dec 29, 2004 3:49 pm

Re: Counting Posts in the viewtopic_body ...

Post by jmueller0823 »

bump.
Locked

Return to “[3.0.x] Support Forum”