When on the last (or first) node of the chosen content type the $last (and $first) variables do not display/exist.
Simple add the following to your the flippy.tpl.php file and note how on the first and last node the nid does not display:
<h1><?php print $current['nid']; ?></h1>
<h1><?php print $first['nid']; ?></h1>
<h1><?php print $last['nid']; ?></h1>
This prevents us from writing logic that would loop through the nodes (send the node back to the first page when the current node is the last node):
<?php if ($current['nid'] == $last['nid']): ?>
<div id="nextPager"><a href="/node/<?php print $first['nid']; ?>"></a></div>
<?php else: ?>
<div id="nextPager"><a href="/node/<?php print $next['nid']; ?>"></a></div>
<?php endif; ?>
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | flippy-loop-1821322.patch | 7.03 KB | freddybushboy |
Comments
Comment #1
hoff331 commentedthe workaround is:
Comment #2
rliComment #3
freddybushboy commentedIf you want to avoid editing the tpl file or having a copy of it in your theme, you can do this quite simply with the
template_preprocess_flippyfunction in your theme's template.php file:Comment #4
freddybushboy commentedI also made a patch which adds the loop checkbox if anyone is interested :)
Comment #5
rliThanks Freddy.
Just committed it to dev.
Comment #6.0
(not verified) commentedgrammatical fixes