Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Doomd on
I've recently migrated a phpbb2 forum to drupal. Some of the migrated users are not happy because of these two issues:
1. They want a pager (page listing like next back etc) to also appear on the top of the forum (or node if I can't specialize).
2. After they post a reply, they need to be redirected to the last page of that node, not the first one.
I don't mind hacking core if I have to.
Also, if anyone knows off the top of their head how I can stop injecting the signature into the comments text area, that would be great.
Thanks for the help!
Comments
modules
Has anyone had any success with another module like actions or path to go for redirecting people that post replies to the actual reply (last page) of that node?
And I just need some help knowing where I should add the pager code so it displays on the top of the node as well as on the bottom. Thank you!
pager on top
I figured out how to place the pager on top of the comments section, but not on top of the entire main content page. But it's a start:
in comment.module in lines 839-859 (drupal 4.7.3)
As you can see, I just copied the last output line and pasted it above the while loop.
This is NOT a complete solution. I would like to be able to place the pager at the very top, above the first topic. In fact, I would really like to be able to completely eliminate the first post being repeated on every page.
pager on top hack
Ok,
I broke down and decided to use javascript to get the page numbers to display on the top of each node in addition to the bottom.
Here's what I did.
I opened up page.tpl.php from my phptemplate theme box_grey and near the top of the main-content area, I inserted the following:
Then at the bottom of the same file I inserted this little bit of javascript:
This javascript very simply checks to see if the pager exists, and if it does gets the contents of the DIV with id "pager" (which is generated automatically at the bottom of your content) and places a copy of that content into variable "tempHTML." Then it simply inserts that tempHTML into our new "top_pager" DIV tag that we created above.
The problem with this method is that the top pager controls won't be visible until the rest of the page loads, and of course, it requires javascript so browswers that have that turned off won't enjoy this feature.
NOTE: You may need to change your css file (drupal.css and/or style.css) to include the new ID "top_pager". Otherwise the #top_pager links won't display the same as the regular #pager links.
WOW
Hey man, that's totally brilliant. I'm implementing that on my site immediately!
the one problem...
... is that new top div, if you add top or bottom margins to it, includes them on the page even if there's no pager to plug in. Damn. I had to pull it out 'cause it was wreaking havoc to my pages--too much space on the top! And to not have margins on the pager (the other option) looks really strange.
using jquery
And now, see the power of jquery:
I use this in the
template.php
file of my theme.This sounds hopefull. How do
This sounds hopefull. How do I use it?
I pasted it in my template.php, but I'm guessing it works in conjunction with one of the above solutions? Can you please explain?
DRUPAL 5.1 "pager" is a CLASS and not an ID
Here is an update to doubledoh's great solution for the top pager:
In page.tpl.php put
<div id="top_pager"></div>
above<?php print $content; ?>
Then, in the bottom of the page, put
That will do the trick
Works perfectly
Wow! Thanks! Works like a charm!
My forum users where waiting for this for a long time.
edit: oops, it's not going well in IE. There's an error:
'pagerElements.0.innerHTML' is null or not an object
Any ideas? I'm not really good at javascript.
This won't help you with
This won't help you with placing the pager but I took the slack/easier option and let the users choose how many comments they want per page :P
The redirection to the first page instead of the last seems to be a long running problem (there are constant questions about it, but they don't seem to get answered as far as I can tell). I'm really hoping they can change it for 4.8 if they're not going to do it in this run.
works at bekandloz | plays at technonaturalist
Just found this solution -
Just found this solution - thanks its a step in the right direction - but it wouldbe great to be able to do it without JS as you say at the very top and stop the annoying replicating. Surely the place which needs to be modified is in node.module?
And of course the redirection to last post. I think these are all just basic forum must haves.
I've been told the solution
I've been told the solution lies in using a hook from the pager function and putting that in template.php and then calling it from the appropriate tpl.php file.
That's extremely cryptic
That's extremely cryptic when you can't code :P
works at bekandloz | plays at technonaturalist
Going to last page of comments after post
I wanted to go to the last page of comments for many different reasons and found a pretty easy fix.
Add this in your template.php file:
Then, in the comment.module, find this section in the function comment_form_submit:
Simply replace the null with "page=".comment_last_page($form_values['nid']) so that it looks like this:
Thanks, will give it a go!
Thanks, will give it a go!
This is cool. I have also
This is cool. I have also been looking for this feature.
Displaying tha last page on opening a forum topic
I just tried reply hack. It works perfect.
Is there a way to display the last page of a forum topic when use clicks on forum topic link.
Thank you, aaron-h! Hack
Thank you, aaron-h! Hack works perfectly to get poster to last page and adjusts screen to the last message. However, in blumarine with flatforum it fails to get the screen to the last message.
I am experimenting with Drupal 5.0, but I guess the problem is not with version of the Drupal, but maybe with flatforum module. My guess is that they did not put target anchors to messages, but don't know how to fix it.
Has anyone had similar problem?
___________
www.akyl.org
Aaron - thats great it
Aaron - thats great it works!
Am trying to figure out how
Am trying to figure out how to get this function which is edited out of comment.module and into its own module or template.php - anyone done this?
*
Small fix for template.php
still you didn't consider
still you didn't consider how the comment are ordered nor viewed.
I edited the patch to consider the ordering.
still it's not working if the user is replying to a comment in the page 2 of 4 pages. it will either redirect him to the first or the last page, but not the second one
anyone can help?!
anyone
anyone .. !!
(subscribing) Siegetheday.Or
(subscribing)
Siegetheday.Org
me too n/t
n/t
Drupal 5.x
Hi - I'm not sure if this is possible in 4.7.x, but I managed to do this in Drupal 5.1 without hacking core. I'm using PHPTemplate, and there are ways to override theme functions in
template.php
. If you look at the entirecomment_render()
function that you modified, you'll see that the last thing it does is calltheme('comment_wrapper', $output)
.This theming call will look for hooks like
*_comment_render()
, or give up and fall back totheme_comment_wrapper()
which is also incomment.module
. This is a great place to jump in and add an extra pager, because the default function only adds a simple DIV.I added the following code to my template.php file (here I use the example name was 'mytemplate'):
What this does, line-by-line:
comment_render()
.comment.module.
to wrap the whole thing in a DIV.Hope this helps. I've got an unruly crowd that's I'm forcing to migrate from phpBB2 to Drupal, just like you, and they're alse asking for your second point — to be sent to the last page from the list of topics. I'll post again if I can figure that one out.
Paul - that looks great -
Paul - that looks great - will try it out.
Paul Kishimoto - jumping to
Paul Kishimoto - jumping to the last unread post - we've got a working patch for that here:
http://drupal.org/node/6162 (right at the end of the thread).
Also, you should put that code for the pager in the phptemplate templates section of the handbook - will preserve it for future people trying to find this.
Thanks...
... for the tip, catch! I'm checking out the patch you linked, and I'll probably end up applying it to my site.
The new handbook page is #141381.
Subscribed
Subscribed
thank you, paul! i don't
thank you, paul!
i don't know if it is related only to my theme, but the problem with your code is that it places a pager not actually on top of the page, but the bottom of the very first message of the forum topic (under node text). can you please explain how i could put a pager above subject of the node page, for example.
For pager on top of the forum thread
I managed to place the pager on the top of the forum thread the way I wanted by making my own page-forum.tpl.php file, but I also want to duplicate it at the bottom of the thread. You can read more at http://drupal.org/node/167240
I'm trying to produce the same effect that the terminus1525 forums have (see http://www.terminus1525.ca/node/35825 )
subscribing
subscribing
Subscribe
Subscribe
I finally found another way to do it...
I found another way and I don't think I saw anyone doing it. It takes advantage of the existing theme. It worked for me and I'm on Drupal 5.7.
print theme('pager')
That inserts the pager exactly where I wanted it with a lot less code. It's just using the built in theming I guess. I'm a designer not a programmer. :)
-
Brandon Buttars
http://www.odindev.com
Must be a 5.x thing, I know
Must be a 5.x thing, I know for a fact you couldn't do it 4.7. Much easier :)
works at bekandloz | plays at technonaturalist
Code in view page header
For other noobs -- put the code from the above comment in the header of the view (page section) to add pager at top (drupal 5)
subscribing
subscribing