Uutiset:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu
Advertisement:

Don't show if there are 8 posts in a page.

Aloittaja PokémonS, tammikuu 18, 2014, 09:27:50 AP

« edellinen - seuraava »

PokémonS

SMF 2.0.6

Hi,
I already have this code, added below the signature:

if ($message['counter'] % 15 == 7) {
echo 'content'
}


How to hide the content if there are 8 posts in a page?
And display the content if there are >8 posts in a page?


Edit:
I want display the content for the 8th post, but it's only displayed if the total of posts in a page is >8 posts.

Thx.
きみと手をつなごう つらいときはもっと
ゼロからはじめよう ほら ほら 手をつなごう
みんな手をつなごう つらいときはもっと
力を合わせよう ほら ほら 手をつなごう

The Wizard

Something like this -   


if ($message['counter'] => 8)
{
what ever you want to happen after 8
} else {
what ever you want to happen before 8
}




PokémonS

@The Wizard,
Thanks for your answer.

I try this:

if ($message['counter'] => 8) {
if ($message['counter'] % 15 == 7) {
echo 'content';
}
}


But it's not what I looking for.
I want display the content for the 8th post, but it's only displayed if the total of posts in a page is >8 posts.

And sorry for my previous message, a little ambiguous, but I have edited it. :)
きみと手をつなごう つらいときはもっと
ゼロからはじめよう ほら ほら 手をつなごう
みんな手をつなごう つらいときはもっと
力を合わせよう ほら ほら 手をつなごう

margarett

There was recently a similar question, regarding the 21st post. Can't find it now but it should solve your issue (considering the necessary adjustments)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

PokémonS

@margarett,

Yes, that's my question too.
-> http://www.simplemachines.org/community/index.php?topic=516811.0

But now, I want to display "the content" in 8th post if the total of posts in a page is >8 posts.
きみと手をつなごう つらいときはもっと
ゼロからはじめよう ほら ほら 手をつなごう
みんな手をつなごう つらいときはもっと
力を合わせよう ほら ほら 手をつなごう

margarett

Just OR you first condition with
(counter == 8)
(Sorry I'm on the phone now, it's not very good to write code :P )
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

PokémonS

@margarett,

Thanks for your answer.
I tried this:

if (($message['counter'] % 15 == 7) or (counter == 8)) {
echo 'content';
}


But "the content" in 8th post is still displayed in 8th post.
I want the "the content" in 8th post is displayed if the total of post in a page is 9 posts or more.
きみと手をつなごう つらいときはもっと
ゼロからはじめよう ほら ほら 手をつなごう
みんな手をつなごう つらいときはもっと
力を合わせよう ほら ほら 手をつなごう

margarett

The Wizard's code should do it, just use > instead of >=

I thought that you want to show it in the 8th post as well.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Advertisement: