Showing "posts" and "topics" in a forum Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

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.
3 posters

    Showing "posts" and "topics" in a forum

    Rhino.Freak
    Rhino.Freak
    Helper
    Helper


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

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

    Post by Rhino.Freak November 29th 2015, 10: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, 1:03 pm; edited 1 time in total
    Rhino.Freak
    Rhino.Freak
    Helper
    Helper


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

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

    Post by Rhino.Freak December 1st 2015, 6:35 am

    Anyone?
    Rhino.Freak
    Rhino.Freak
    Helper
    Helper


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

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

    Post by Rhino.Freak December 3rd 2015, 5: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

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

    Post by Rhino.Freak December 6th 2015, 8:55 am

    Bump again I guess
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51552
    Reputation : 3523
    Language : English
    Location : United States

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

    Post by SLGray December 6th 2015, 8: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.
    Rhino.Freak
    Rhino.Freak
    Helper
    Helper


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

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

    Post by Rhino.Freak December 6th 2015, 11:57 am

    No I just want that it says "1 post" and "1 topic" instead of "1 posts" and "1 topics"
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

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

    Post by Ange Tuteur December 7th 2015, 3: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.
    Rhino.Freak
    Rhino.Freak
    Helper
    Helper


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

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

    Post by Rhino.Freak December 8th 2015, 8: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
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51552
    Reputation : 3523
    Language : English
    Location : United States

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

    Post by SLGray December 8th 2015, 1:23 pm

    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.