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 varkenshand on
I'm completely stuck with trying to get Custom Pagers to display node titles instead of prev/next links in D6.
Tried everything, even changing the module by inserting a function that worked in D5 but to no avail.
Also installed the token module, but this does not seem to make any difference. The Custom Pager will not take [title] or [node-title] as an argument.
There must be a way to accomplish this...
Comments
Strange
I seem to be the only person in the world having this problem...
Same problem with 6.x-1.10-beta1
Rolled back... same result. Suppose I'll have to dig into the code now.
You're not alone
No, I'm having the same issue. Did you ever find a resolution? I'm using the dev snapshot, as recommended by http://drupal.org/node/371358, but I'm about to roll back to 6.x-1.10-beta1 to see if that version works. If it does, it should be easy enough to zero in on the problem.
Quick patch
I spent some time looking at this and don't really see how it ever "used the page title by default" (as stated by the documentation). I'm no PHP programmer, but that didn't prevent me from hacking a work-around, below. I'm posting it in case it helps you out--but bear in mind it might be whack. (It seems to work for me, but who knows if it's performant, etc.)
The patch should be applied against the dev snapshot.
-peter
Is this easier?
I'm working on a custom pager for a multi-user blog, where posts from different users are linked together by a custom content type. So I've used "newer" and "older" as follows:
$newer = node_load($nav['prev']);
$newer = node_page_title($newer);
$older = node_load($nav['next']);
$older = node_page_title($older);
$vars['previous'] = !empty($nav['prev']) ?l('< ' . $newer, 'node/'. $nav['prev']) : '';
$vars['key'] = t('@count of @count_total', array('@count' => ($nav['current_index'] + 1), '@count_total' => count($nav['full_list'])));
$vars['next'] = !empty($nav['next']) ?l($older . ' >', 'node/'. $nav['next']) : '';
Like the previous commenter, I'm not much of a programmer, so if there's a problem here, please let me know.
security
On another post, joachim says "No need to call node_page_title(). Just say $node->title.
And it's *essential* for security that you run it through check_plain()! That's raw user input you are printing there!"
See node
See node http://drupal.org/node/387786
Related
http://drupal.org/node/428540
https://www.martin.postma.website/