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 November 29th 2015, 8:31 am

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 December 8th 2015, 11:03 am; 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 December 1st 2015, 4:35 am

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 December 3rd 2015, 3:16 pm

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 December 6th 2015, 6:55 am

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 December 6th 2015, 6:58 am

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 : 51567
Reputation : 3525
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 December 6th 2015, 9:57 am

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 December 7th 2015, 1:14 pm

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 : 13207
Reputation : 3000
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 December 8th 2015, 6:45 am

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 December 8th 2015, 11:23 am

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 : 51567
Reputation : 3525
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