The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Showing "posts" and "topics" in a forum

3 posters

Go down

Solved Showing "posts" and "topics" in a forum

Post by Rhino.Freak Sun 29 Nov - 3:31

Hello all!
So currently this is what my forum looks like
http://prntscr.com/987j54

I have an edited
Code:
index_box
template. And I believe the part of code responsible for the upper changes is as follows :
Code:
<dd class="posts">{catrow.forumrow.POSTS} {L_POSTS}</dd>
 <dd class="topics">{catrow.forumrow.TOPICS} {L_TOPICS}</dd>

However you can see an error in the screenshot I provided, it says "1 topics" which is grammatically incorrect.
Can someone help me with a javascript code that would make 'posts to post' and 'topics to topic' when their count is 0?

Thanks!
#phpbb3
Forum Link


Last edited by Rhino.Freak on Tue 8 Dec - 6:03; edited 1 time in total
Rhino.Freak
Rhino.Freak
Helper
Helper

Male Posts : 1248
Reputation : 104
Language : English
Location : Mumbai, India

http://freetest.forumotion.net/

Back to top Go down

Solved Re: Showing "posts" and "topics" in a forum

Post by Rhino.Freak Mon 30 Nov - 23:35

Anyone?
Rhino.Freak
Rhino.Freak
Helper
Helper

Male Posts : 1248
Reputation : 104
Language : English
Location : Mumbai, India

http://freetest.forumotion.net/

Back to top Go down

Solved Re: Showing "posts" and "topics" in a forum

Post by Rhino.Freak Thu 3 Dec - 10:16

Showing "posts" and "topics" in a forum 1f610 one more bump I guess?
Rhino.Freak
Rhino.Freak
Helper
Helper

Male Posts : 1248
Reputation : 104
Language : English
Location : Mumbai, India

http://freetest.forumotion.net/

Back to top Go down

Solved Re: Showing "posts" and "topics" in a forum

Post by Rhino.Freak Sun 6 Dec - 1:55

Bump again I guess
Rhino.Freak
Rhino.Freak
Helper
Helper

Male Posts : 1248
Reputation : 104
Language : English
Location : Mumbai, India

http://freetest.forumotion.net/

Back to top Go down

Solved Re: Showing "posts" and "topics" in a forum

Post by SLGray Sun 6 Dec - 1:58

Do you want to change last posts, too?


Showing "posts" and "topics" in a forum Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51194
Reputation : 3508
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: Showing "posts" and "topics" in a forum

Post by Rhino.Freak Sun 6 Dec - 4:57

No I just want that it says "1 post" and "1 topic" instead of "1 posts" and "1 topics"
Rhino.Freak
Rhino.Freak
Helper
Helper

Male Posts : 1248
Reputation : 104
Language : English
Location : Mumbai, India

http://freetest.forumotion.net/

Back to top Go down

Solved Re: Showing "posts" and "topics" in a forum

Post by Ange Tuteur Mon 7 Dec - 8:14

Hi @Rhino.Freak,

Go to Modules > JavaScript codes management > New

Placement : In all the pages
Code:
$(function() {
  for (var a = $('.topics, .posts, .views'), i = 0, j = a.length, s; i < j; i++) {
    s = a[i].innerHTML;
    if (+s.replace(/(\d+).*/, '$1') == 1) {
      a[i].innerHTML = s.slice(0, s.length - 1);
    }
  }
});

That should remove the "s" off the end of the texts if the value is equal to 1.

P.S.
Sorry for the late reply.
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13244
Reputation : 2998
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Showing "posts" and "topics" in a forum

Post by Rhino.Freak Tue 8 Dec - 1:45

Thank you so much Smile Works just like how it should!
PS: Don't be sorry, it's not your job but voluntary help and I thank you for helping! Very Happy
Rhino.Freak
Rhino.Freak
Helper
Helper

Male Posts : 1248
Reputation : 104
Language : English
Location : Mumbai, India

http://freetest.forumotion.net/

Back to top Go down

Solved Re: Showing "posts" and "topics" in a forum

Post by SLGray Tue 8 Dec - 6:23

Topic solved and archived


Showing "posts" and "topics" in a forum Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51194
Reputation : 3508
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum