SMF 2.0.6
Hi,
I already add some content below signature for the first post, I use:
if ($message['id'] == $context['topic_first_message']) {
echo 'content here';
}
The content is only displayed for first post.
How to display the content for 21st post, 41st post, 61st post... and so on?
Thx.
Try using something like this instead. It should only show something for the the first post on each page.
if (!isset($show_this))
{
echo 'content here';
$show_this = true;
}
Take a look at $message['counter']. That will tell you what reply # that message is (0 for the first post in the topic, 1 for the first reply, etc.).
For example, to display something after the 21st post:
if ($message['counter'] == 20)
{
// Code to display whatever you want here
}
PokémonS,
if ($message['id'] % 20 == 1) {
echo 'content here';
}
Thanks all!
Everyone's codes are worked perfectly. :3