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 2 of 2 Previous  1, 2

Go down

Solved Post Number for phpBB3

Post by Mati December 28th 2014, 10:25 pm

First topic message reminder :

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
Mati
Hyperactive

Posts : 2020
Reputation : 330
Language : HTML, CSS & JavaScript
Location : Forum Services

https://forumservice.forumotion.com/

Back to top Go down


Solved Re: Post Number for phpBB3

Post by Ange Tuteur December 31st 2014, 7:48 pm

@Michael_vx,

For phpbb2 :

Find :
Code:
<td><span class="postdetails"><img src="{postrow.displayed.MINI_POST_IMG}" alt="{postrow.displayed.L_MINI_POST_ALT}" title="{postrow.displayed.L_MINI_POST_ALT}" border="0" />{L_POST_SUBJECT}: {postrow.displayed.POST_SUBJECT}&nbsp; &nbsp;<img src="{postrow.displayed.MINI_TIME_IMG}" alt="" border="0" />{postrow.displayed.POST_DATE}</span></td>

Replace by :
Code:
<td><span class="postdetails"><a class="postNumber" href="{postrow.displayed.POST_URL}">#{postrow.displayed.COUNT_POSTS}</a><img src="{postrow.displayed.MINI_POST_IMG}" alt="{postrow.displayed.L_MINI_POST_ALT}" title="{postrow.displayed.L_MINI_POST_ALT}" border="0" />{L_POST_SUBJECT}: {postrow.displayed.POST_SUBJECT}&nbsp; &nbsp;<img src="{postrow.displayed.MINI_TIME_IMG}" alt="" border="0" />{postrow.displayed.POST_DATE}</span></td>

Save and publish. Add
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
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 January 1st 2015, 9:13 am

ops 1st
i thought my reply was sent last night i think internet fooled me Very Happy
any way thanks a lot @Ange Tuteur
so the code you provide before this was for phpbb3 ? or other version
i like to know if you dont mind Smile
Michael_vx
Michael_vx
Forumember

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

Back to top Go down

Solved Re: Post Number for phpBB3

Post by inallsorts January 1st 2015, 12:27 pm

Hi,

Enter this In the JavaScript code management (select "In all the topics):

Code:
$(function() {
           var posts_per_page = 20; //number of posts you have displayed per page in topics.
           var page = document.title.match(/-\sPage\s(\d+)$/), page = page ? page[1] : 1;
           var posts = $('.postprofile', document.getElementById('main-content')), postnum = (page - 1) * posts_per_page;
           for(var i = 0; i < posts_per_page; i++) {
              if(!posts[i]) break;
              var link = posts[i].previousSibling.getElementsByTagName('h2')[0].getElementsByTagName('a')[0].href;
              posts[i].innerHTML = '<span class="postnumber"><a href="' + link + '">#' + ++postnum + '</a></span>' + posts[i].innerHTML;
           }
        });

Adjust the "var posts_per_page = 20", with the amount of posts per page on your forum.

Then enter this In the CSS:

Code:
  .postnumber {
          float:right;
          font-size: 1.2em;
        }

Adjust the "float:right" as per your forum's profile position. If It's on the left, enter "float:left".
avatar
inallsorts
Forumember

Posts : 246
Reputation : 8
Language : English

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati January 1st 2015, 3:34 pm

Hello @inallsorts, code is not working...
Mati
Mati
Hyperactive

Posts : 2020
Reputation : 330
Language : HTML, CSS & JavaScript
Location : Forum Services

https://forumservice.forumotion.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Ange Tuteur January 2nd 2015, 1:59 am

Hi Mati,

This did not work for you ?
Ange Tuteur wrote: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 : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Post Number for phpBB3

Post by inallsorts January 2nd 2015, 8:08 am

Mati™ wrote:Hello @inallsorts, code is not working...

Hi Mati,

The aforementioned code I posted, will not work If the "Always show the first post in the topics" Is enabled via "ACP > General > Messages and e-mails > Configuration". The radio button must be set to "No".
Also (In the same ACP directory), the "Number of posts from previous page to display on last page" must be set to "0".

Do you have either or both options enabled?
avatar
inallsorts
Forumember

Posts : 246
Reputation : 8
Language : English

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati January 2nd 2015, 11:19 am

Ange Tuteur wrote:Hi Mati,

This did not work for you ?
Ange Tuteur wrote: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 }

This code works Smile problem is solved and topic can be locked now thanks guys!
Mati
Mati
Hyperactive

Posts : 2020
Reputation : 330
Language : HTML, CSS & JavaScript
Location : Forum Services

https://forumservice.forumotion.com/

Back to top Go down

Solved Re: Post Number for phpBB3

Post by AlexisMcDevin January 2nd 2015, 12:24 pm

I remember that we still have two things are not solved.

- Small style for post number below does not work with Ange's code.
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;
}
- Mati still has a question: How to make it clickable like when you click on it it will pop up a box with the link for that post.
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 Base January 3rd 2015, 12:32 am

Solved => Archived

Any new questions can be asked in a new topic. Thanks!
Base
Base
Forumaster

Male Posts : 10386
Reputation : 1695
Language : English and French
Location : United Kingdom, England

http://forumotionhub.net

Back to top Go down

Page 2 of 2 Previous  1, 2

Back to top

- Similar topics

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