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.

Post Number for phpBB3

+4
Eugeo Igvalt
AlexisMcDevin
Michael_vx
Mati
8 posters

Page 1 of 2 1, 2  Next

Go down

Solved Post Number for phpBB3

Post by Mati Sun Dec 28, 2014 9:25 pm

I would like to add a post number count on every post for phpBB3

Ex:
Post Number: #1
Post Number: #2
Post Number: #3


Last edited by Mati™ on Fri Jan 02, 2015 10:22 am; edited 1 time in total
Mati
Mati
Active Poster

Posts : 1933
Reputation : 333
Language : HTML, CSS & JavaScript
Location : Forum Services

https://fm-focus.forumotion.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati Tue Dec 30, 2014 11:20 am

Any answer for this?
Mati
Mati
Active Poster

Posts : 1933
Reputation : 333
Language : HTML, CSS & JavaScript
Location : Forum Services

https://fm-focus.forumotion.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Michael_vx Tue Dec 30, 2014 2:23 pm

i think this could work
in javascript


Code:
var CopyrightNotice = 'Copyright Code By Sam Hameed & my-as7ab.com';$(function(){$(".hr").each(function(index){$(this).after(" <strong>  مساهمة[</strong><font color='red'>"+index+"</font><strong>] </strong>")})});
Michael_vx
Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: Post Number for phpBB3

Post by AlexisMcDevin Tue Dec 30, 2014 3:00 pm

Michael_vx wrote:i think this could work
in javascript


Code:
var CopyrightNotice = 'Copyright Code By Sam Hameed & my-as7ab.com';$(function(){$(".hr").each(function(index){$(this).after(" <strong>  مساهمة[</strong><font color='red'>"+index+"</font><strong>] </strong>")})});

I also need this. Above code did not work.
AlexisMcDevin
AlexisMcDevin
Forumember

Male Posts : 134
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati Tue Dec 30, 2014 5:36 pm

Nothing really happen  Confused
Mati
Mati
Active Poster

Posts : 1933
Reputation : 333
Language : HTML, CSS & JavaScript
Location : Forum Services

https://fm-focus.forumotion.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Eugeo Igvalt Tue Dec 30, 2014 5:58 pm

It's not working. I would also like to have this.
Eugeo Igvalt
Eugeo Igvalt
Forumember

Male Posts : 289
Reputation : 17
Language : EN, SPA
Location : Puerto Rico

http://www.NewbForums.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by _Twisted_Mods_ Tue Dec 30, 2014 6:11 pm

you you want the # to start over on each page or keep going up?
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Ange Tuteur Tue Dec 30, 2014 6:15 pm

Hi @Mati™,

You can edit the viewtopic_body template to add {postrow.displayed.COUNT_POSTS_NUMBER} wherever you like. The result would be : Post n°57, but if you don't want that you can modify the variable like this :
Code:
<span class="postNumber">{postrow.displayed.COUNT_POSTS_NUMBER}</span><script type="text/javascript">(function(){var tag = '#'; for (var i=0,n=document.getElementsByTagName('SPAN'); i<n.length; i++) if (/postNumber/.test(n[i].className)) n[i].innerHTML = n[i].innerHTML.replace(/^.*?n°(\d+)/,tag+'$1')})();</script>

The tag variable in the script determines the tag next to the number. If you just want the number you can leave the string blank. e.g. tag = '';
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: Post Number for phpBB3

Post by Mati Tue Dec 30, 2014 6:29 pm

@Ange Tuteur

How to make it clickable like when you click on it it will pop up a box with the link for that post.
Mati
Mati
Active Poster

Posts : 1933
Reputation : 333
Language : HTML, CSS & JavaScript
Location : Forum Services

https://fm-focus.forumotion.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by _Twisted_Mods_ Tue Dec 30, 2014 6:40 pm

i have the script finished just need know how the link goes for directing to a certain post


update

Code:
$(function(){
torb = "top"
lorr = "right"
$('#main-content .post').each(function(index){
  var count1 = $('.pagination:last>strong:first').text();
  count2 = index;
 if(count1>1){  count2 = $('#main-content .post').length+index*count1}

  turl = $(this).attr('id')
  turl = location.href + "#" + turl
  if (torb=="top"){
    if (lorr=="left"){ $(this).prepend(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> '); }else{$(this).prepend(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> '); }
  }else{
    if (lorr=="left"){$(this).append(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> '); }else{$(this).append(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> ');    }
}
})
});
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by AlexisMcDevin Tue Dec 30, 2014 7:19 pm

I am sorry to jump here.

I tried with three ways above but nothing happening.

@"Mati™" Do you try these yet?
AlexisMcDevin
AlexisMcDevin
Forumember

Male Posts : 134
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by _Twisted_Mods_ Tue Dec 30, 2014 7:24 pm

my fault try this

Code:
    $(function(){
    torb = "top";
    lorr = "right";
    $('#main-content .post').each(function(index){
      var count1 = $('.pagination:last>strong:first').text();
      count2 = index;
    if(count1>1){  count2 = $('#main-content .post').length+index*count1;}

      turl = $(this).attr('id');
      turl = location.href + "#" + turl;
      if (torb=="top"){
        if (lorr=="left"){
          $(this).prepend(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> ');
        }else{
          $(this).prepend(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> ');
        }
      }else{
        if (lorr=="left"){
          $(this).append(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> ');
        }else{
          $(this).append(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> ');
        }
    }
    })
    });
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by AlexisMcDevin Tue Dec 30, 2014 7:37 pm

@_Twisted_Mods_,

It worked but the button in left hand. It should be at right hand, right? Can you make text bold?

I edit my post because we have one more problem. All the number are in even number.

Post Number for phpBB3 10887630_689563461157599_1796086422122231881_o


Last edited by AlexisMcDevin on Tue Dec 30, 2014 7:48 pm; edited 1 time in total (Reason for editing : show more detail)
AlexisMcDevin
AlexisMcDevin
Forumember

Male Posts : 134
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by _Twisted_Mods_ Tue Dec 30, 2014 7:52 pm

Code:
 torb = "top";
    lorr = "right";

torb = top or bottom

lorr = left or right

you can set where its located

also you can style it in css with

#ppostc{}

example

Code:
#ppostc {
    font-weight: bold;
    font-size: 1em;
    border: 1px solid white;
    width: 50px;
    text-align: center;
    border-radius: 5px;
    background-color: gray;
    color: black !important;
}
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by AlexisMcDevin Tue Dec 30, 2014 8:18 pm

@_Twisted_Mods_,

Can you review my post above again. May I edited my post while you are working, so you do not know that.

All the numbers are in even number. Like: #20, #22, #24,...

And I changed lorr = "left", however, the post number does not move to another side.
AlexisMcDevin
AlexisMcDevin
Forumember

Male Posts : 134
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati Tue Dec 30, 2014 8:34 pm

_Twisted_Mods_ wrote:my fault try this

Code:
    $(function(){
    torb = "top";
    lorr = "right";
    $('#main-content .post').each(function(index){
      var count1 = $('.pagination:last>strong:first').text();
      count2 = index;
    if(count1>1){  count2 = $('#main-content .post').length+index*count1;}

      turl = $(this).attr('id');
      turl = location.href + "#" + turl;
      if (torb=="top"){
        if (lorr=="left"){
          $(this).prepend(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> ');
        }else{
          $(this).prepend(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> ');
        }
      }else{
        if (lorr=="left"){
          $(this).append(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> ');
        }else{
          $(this).append(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> ');
        }
    }
    })
    });

@_Twisted_Mods_

How to make it clickable like when you click on it it will pop up a box with the link for that post.
Mati
Mati
Active Poster

Posts : 1933
Reputation : 333
Language : HTML, CSS & JavaScript
Location : Forum Services

https://fm-focus.forumotion.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by AlexisMcDevin Tue Dec 30, 2014 9:02 pm

Hi @Mati™,

Have you applied your code yet? I changed all Left by right but the post numbers are still in left.

And we have more problem:

- In the page No.1, post number showed like this: #0, #1, #2, #3,....,#9. (First page works well)
- In the page No.2, post number showed like this: #10, #12, #14,..., #28. (all in even number).
- In the page No.3, post number showed like this: #10, #13, #16,...,#37.

I do not know why!

Please come to my forum and check this @ HERE
AlexisMcDevin
AlexisMcDevin
Forumember

Male Posts : 134
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati Tue Dec 30, 2014 9:08 pm

Just change your CSS with this.

Code:
#ppostc {
    background-color: #d3d3d3;
    border: 1px solid #fff;
    border-radius: 5px;
    color: #000 !important;
    font-size: 1em;
    font-weight: 700;
    text-align: center;
    width: 50px;
    float: right;
}
Mati
Mati
Active Poster

Posts : 1933
Reputation : 333
Language : HTML, CSS & JavaScript
Location : Forum Services

https://fm-focus.forumotion.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by _Twisted_Mods_ Tue Dec 30, 2014 9:19 pm

ok give me min i prob did my mah wrong in the code... matti i added ur popup just give me sec to check the post on second page
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati Tue Dec 30, 2014 9:27 pm

_Twisted_Mods_ wrote:ok give me min i prob did my mah wrong in the code... matti i added ur popup just give me sec to check the post on second page

@Ange Tuteur, code start counting from 1 and yours from 0 so can you make it to count from 1 instead 0.
Mati
Mati
Active Poster

Posts : 1933
Reputation : 333
Language : HTML, CSS & JavaScript
Location : Forum Services

https://fm-focus.forumotion.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by _Twisted_Mods_ Tue Dec 30, 2014 9:30 pm

ok everything should be good now

Code:

        $(function(){
        
        torb = "top";
        lorr = "right";
        $('#main-content .post').each(function(index){
          var count1 = $('.pagination:last>strong:first').text();
          count2 = index;
        if(count1>1){  count2 = ($('#main-content .post').length-1*count1)+index;}

          turl = $(this).attr('id');
          turl = location.href + "#" + turl;
          if (torb=="top"){
            if (lorr=="left"){
              $(this).prepend(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> ');
            }else{
              $(this).prepend(' <div id="ppostc" style="float:right;"><a href="'+turl+'">#'+count2+'</a></div> ');
            }
          }else{
            if (lorr=="left"){
              $(this).append(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> ');
            }else{
              $(this).append(' <div id="ppostc" style="float:right;"><a href="'+turl+'">#'+count2+'</a></div> ');
            }
        }
        })
        $('#ppostc a').click(function() {
        alert($(this).attr("href"));
        });
        });
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by AlexisMcDevin Tue Dec 30, 2014 9:36 pm

Opps, all post numbers are lost!

Can you try again?

Thank you!
AlexisMcDevin
AlexisMcDevin
Forumember

Male Posts : 134
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati Tue Dec 30, 2014 9:39 pm

Mati
Mati
Active Poster

Posts : 1933
Reputation : 333
Language : HTML, CSS & JavaScript
Location : Forum Services

https://fm-focus.forumotion.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by _Twisted_Mods_ Tue Dec 30, 2014 9:51 pm

lol im messing up alot today


Code:
        $(function(){
       
        torb = "top";
        lorr = "right";
        $('#main-content .post').each(function(index){
          var count1 = $('.pagination:last>strong:first').text();
          count2 = index+1;
        if(count1>1){  count2 = ($('#main-content .post').length-1*count1)+index+1;}

          turl = $(this).attr('id');
          turl = location.href + "#" + turl;
          if (torb=="top"){
            if (lorr=="left"){
              $(this).prepend(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> ');
            }else{
              $(this).prepend(' <div id="ppostc" style="float:right;"><a href="'+turl+'">#'+count2+'</a></div> ');
            };
          }else{
            if (lorr=="left"){
              $(this).append(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> ');
            }else{
              $(this).append(' <div id="ppostc" style="float:right;"><a href="'+turl+'">#'+count2+'</a></div> ');
            };
        };
        });
        $('#ppostc a').click(function() {
        alert($(this).attr("href"));
        });
        });
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by AlexisMcDevin Tue Dec 30, 2014 10:00 pm


I still have problem with post number like below:

- Page No.1: #1, #2, #3,....#9, #10 (Okay)
- Page No.2: #9, # 10, #11,..., #17, #18 ( repeat #9 and #10)
- Page No.3: #8, #9, #10,..., #16, #17 (Wrong number)

Please try this again!
Thank you!
AlexisMcDevin
AlexisMcDevin
Forumember

Male Posts : 134
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati Tue Dec 30, 2014 10:05 pm

Yes is not counting correct I have 15 post per page after 15 is not counting 16 17 18 and so on...
Mati
Mati
Active Poster

Posts : 1933
Reputation : 333
Language : HTML, CSS & JavaScript
Location : Forum Services

https://fm-focus.forumotion.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by AlexisMcDevin Tue Dec 30, 2014 10:25 pm

Mati™ wrote:Yes is not counting correct I have 15 post per page after 15 is not counting 16 17 18 and so on...

Hi Mati,

Sorry again to make some noise into your topic!

I have a question from here. Can you come there?

Thank you!
AlexisMcDevin
AlexisMcDevin
Forumember

Male Posts : 134
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Michael_vx Tue Dec 30, 2014 10:32 pm

_Twisted_Mods_ wrote:lol im messing up alot today


Code:
        $(function(){
        
        torb = "top";
        lorr = "right";
        $('#main-content .post').each(function(index){
          var count1 = $('.pagination:last>strong:first').text();
          count2 = index+1;
        if(count1>1){  count2 = ($('#main-content .post').length-1*count1)+index+1;}

          turl = $(this).attr('id');
          turl = location.href + "#" + turl;
          if (torb=="top"){
            if (lorr=="left"){
              $(this).prepend(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> ');
            }else{
              $(this).prepend(' <div id="ppostc" style="float:right;"><a href="'+turl+'">#'+count2+'</a></div> ');
            };
          }else{
            if (lorr=="left"){
              $(this).append(' <div id="ppostc"><a href="'+turl+'">#'+count2+'</a></div> ');
            }else{
              $(this).append(' <div id="ppostc" style="float:right;"><a href="'+turl+'">#'+count2+'</a></div> ');
            };
        };
        });
        $('#ppostc a').click(function() {
        alert($(this).attr("href"));
        });
        });
after test working with phpbb3 and punbb good Smile
Michael_vx
Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Ange Tuteur Tue Dec 30, 2014 10:33 pm

@AlexisMcDevin, please take such conversation to Private Messages. Wink

@Mati™️, try this :

Go to Administration Panel > Display > Templates > General > viewtopic_body Edit

Find :
Code:
<div style="position: relative; top: -30px; width: 1px;" id="{postrow.displayed.U_POST_ID}"></div>

Replace by :
Code:
<div style="position: relative; top: -30px; width: 1px;" id="{postrow.displayed.U_POST_ID}"></div>
<div class="postNumberContainer"><a href="{postrow.displayed.POST_URL}" class="postNumber">#{postrow.displayed.COUNT_POSTS}</a></div>

Save and publish Add

Use CSS to change the alignment :
Display > Colors > CSS stylesheet
Code:
.postNumberContainer { text-align:right }
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: Post Number for phpBB3

Post by Michael_vx Wed Dec 31, 2014 12:19 am

@Ange Tuteur
is this code for phpbb2 or can work on any version Very Happy
i like to collect info Very Happy
thanks
and sorry for my unhelpful code
Michael_vx
Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Page 1 of 2 1, 2  Next

Back to top

- Similar topics

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