The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Showing "posts" and "topics" in a forum

View previous topic View next topic Go down

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

Post by Rhino.Freak on 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
avatar
Rhino.Freak
Helper
Helper

Male Posts : 1248
Reputation : 105
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 on December 1st 2015, 4:35 am

Anyone?
avatar
Rhino.Freak
Helper
Helper

Male Posts : 1248
Reputation : 105
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 on December 3rd 2015, 3:16 pm

one more bump I guess?
avatar
Rhino.Freak
Helper
Helper

Male Posts : 1248
Reputation : 105
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 on December 6th 2015, 6:55 am

Bump again I guess
avatar
Rhino.Freak
Helper
Helper

Male Posts : 1248
Reputation : 105
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 on December 6th 2015, 6:58 am

Do you want to change last posts, too?


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

avatar
SLGray
Administrator
Administrator

Male Posts : 38237
Reputation : 2576
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

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

Post by Rhino.Freak on 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"
avatar
Rhino.Freak
Helper
Helper

Male Posts : 1248
Reputation : 105
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 on 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.
avatar
Ange Tuteur
Forumaster

Male Posts : 13083
Reputation : 2758
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

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

Post by Rhino.Freak on 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
avatar
Rhino.Freak
Helper
Helper

Male Posts : 1248
Reputation : 105
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 on December 8th 2015, 11:23 am

Topic solved and archived


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

avatar
SLGray
Administrator
Administrator

Male Posts : 38237
Reputation : 2576
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


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