News:

SMF 2.1.6 has been released! Take it for a spin! Read more.

Main Menu

Add content below signature

Started by PokémonS, January 11, 2014, 02:57:33 AM

Previous topic - Next topic

PokémonS

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.
きみと手をつなごう つらいときはもっと
ゼロからはじめよう ほら ほら 手をつなごう
みんな手をつなごう つらいときはもっと
力を合わせよう ほら ほら 手をつなごう

Kays

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;
}

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Oldiesmann

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
}

Chen Zhen

PokémonS,


if ($message['id'] % 20 == 1) {
echo 'content here';
}

My SMF Mods & Plug-Ins

WebDev

SMF support staff should be shaping a positive community experience & not provoking an argument or emotional reaction.

PokémonS

Thanks all!
Everyone's codes are worked perfectly. :3
きみと手をつなごう つらいときはもっと
ゼロからはじめよう ほら ほら 手をつなごう
みんな手をつなごう つらいときはもっと
力を合わせよう ほら ほら 手をつなごう

Advertisement: