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

View previous topic View next topic Go down

Solved Post Number for phpBB3

Post by Mati on 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
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 Ange Tuteur on 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
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 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
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 inallsorts on 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".

inallsorts
Forumember

Posts : 246
Reputation : 8
Language : English

Back to top Go down

Solved Re: Post Number for phpBB3

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

Hello @inallsorts, code is not working...

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 Ange Tuteur on 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
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 inallsorts on 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?

inallsorts
Forumember

Posts : 246
Reputation : 8
Language : English

Back to top Go down

Solved Re: Post Number for phpBB3

Post by Mati on 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
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 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
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 Base on January 3rd 2015, 12:32 am

Solved => Archived

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

Base
Forumaster

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

http://forumotionhub.net

Back to top Go down

Page 2 of 2 Previous  1, 2

View previous topic View next topic Back to top


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