Is that possible to show next/prev node title instead of prev/next links as now?

Comments

Aurochs’s picture

Fully support that. Would be great to have possibility to customize the links with titles and fields from next nodes.
Would be awesome to have similar to this Russian MSN page: http://goo.gl/5q3pt

dooug’s picture

You can load the nodes the get the node object to print the titles (or whatever else from the node).

Here is my example from my custom flippy.tpl.php:
(my example uses the $list variable for the nids, to use $prev, etc.. see: this issue

$prev_node = node_load($list['prev']); // load prev node
$next_node = node_load($list['next']); // load next node

?>
<ul class="flippy">
<?php if(!empty($list['prev'])): ?> 
  <li class="previous"><span class="pager_link"><?php print "<< " . l($prev_node->title, "node/" . $list['prev']); ?></span></li>
<?php endif; ?>
<?php if(!empty($list['next'])): ?> 
  <li class="next"><span class="pager_link"><?php print l($next_node->title, "node/" . $list['next']) . " >>"; ?></span></li>
<?php endif; ?>
</ul>

However, this doesn't seem very efficient to load these. Maybe we should patch the module to include these titles in a variable array on this tpl?

dooug’s picture

StatusFileSize
new4.19 KB

Attached is a patch to the flippy module that includes the node titles in the flippy pager variables in the flippy.tpl.php.

It also includes my patch that includes the template variables: #1299436: Undefined variables $next, $prev, $current etc.

dooug’s picture

StatusFileSize
new4.68 KB

Latest patch attached includes all my changes, including fixing the flippy_preprocess_node function to pass-by-reference the $vars variable.

Aurochs’s picture

Great - many thanks!

mgladding’s picture

I tried out the patch, but instead of seeing the node titles, just get "Array" as the output. Any ideas?

dooug’s picture

The patch changes the flippy.tpl.php so the $current, $next, $prev etc are arrays with keys 'nid' and 'title'.

For instance, $current['title'] should give you the current title.

mgladding’s picture

Thanks!

So now, how would I go about making said title a link to the content?

Aurochs’s picture

<a href="node/<?php print $next['nid']; ?>"> <?php print $next['title']; ?></a>

Just a suggestion i did not try it yet...

eaton’s picture

Status: Active » Fixed

The ability to show the title of each node as the link name is in the current dev release. I'll look through this patch and see if there are other fixes, but for the moment I'm marking the original issue as fixed. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.