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.

Post Number for phpBB3

Page 1 of 2 1, 2  Next

View previous topic View next topic Go down

Solved Post Number for phpBB3

Post by Mati on December 28th 2014, 10: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 January 2nd 2015, 11:22 am; edited 1 time in total

Mati
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati on December 30th 2014, 12:20 pm

Any answer for this?

Mati
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Michael_vx on December 30th 2014, 3: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
Forumember

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

Back to top Go down

Solved Re: Post Number for phpBB3

Post by AlexisMcDevin on December 30th 2014, 4: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
Forumember

Male Posts : 133
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati on December 30th 2014, 6:36 pm

Nothing really happen  Confused

Mati
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Eugeo Igvalt on December 30th 2014, 6:58 pm

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

Eugeo Igvalt
Forumember

Male Posts : 287
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_ on December 30th 2014, 7:11 pm

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

_Twisted_Mods_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Ange Tuteur on December 30th 2014, 7: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
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati on December 30th 2014, 7: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
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by _Twisted_Mods_ on December 30th 2014, 7: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_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by AlexisMcDevin on December 30th 2014, 8:19 pm

I am sorry to jump here.

I tried with three ways above but nothing happening.

@"Mati™" Do you try these yet?

AlexisMcDevin
Forumember

Male Posts : 133
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by _Twisted_Mods_ on December 30th 2014, 8: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_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by AlexisMcDevin on December 30th 2014, 8: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.



Last edited by AlexisMcDevin on December 30th 2014, 8:48 pm; edited 1 time in total (Reason for editing : show more detail)

AlexisMcDevin
Forumember

Male Posts : 133
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by _Twisted_Mods_ on December 30th 2014, 8: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_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by AlexisMcDevin on December 30th 2014, 9: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
Forumember

Male Posts : 133
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati on December 30th 2014, 9: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
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by AlexisMcDevin on December 30th 2014, 10: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
Forumember

Male Posts : 133
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati on December 30th 2014, 10: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
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by _Twisted_Mods_ on December 30th 2014, 10: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_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati on December 30th 2014, 10: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
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by _Twisted_Mods_ on December 30th 2014, 10: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_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by AlexisMcDevin on December 30th 2014, 10:36 pm

Opps, all post numbers are lost!

Can you try again?

Thank you!

AlexisMcDevin
Forumember

Male Posts : 133
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati on December 30th 2014, 10:39 pm


Mati
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by _Twisted_Mods_ on December 30th 2014, 10: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_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by AlexisMcDevin on December 30th 2014, 11: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
Forumember

Male Posts : 133
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati on December 30th 2014, 11: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
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by AlexisMcDevin on December 30th 2014, 11: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
Forumember

Male Posts : 133
Reputation : 5
Language : English

http://ccxiqi.forumvi.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Michael_vx on December 30th 2014, 11: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
Forumember

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

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Ange Tuteur on December 30th 2014, 11: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
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Michael_vx on December 31st 2014, 1: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
Forumember

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

Back to top Go down

Page 1 of 2 1, 2  Next

View previous topic View next topic Back to top


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