Jump to content

Next Database Record


Dominyka

Recommended Posts

I know there is a way to get the next Unread Database record

$record->url()->setQueryString( array( 'do' => 'nextUnread' ) )

$record->url()->setQueryString( array( 'do' => 'nextUnread' ) )

But can I get the next record regardless of whether it has been read or not? 'do' => 'next' doesn't work.

Link to comment
Share on other sites

{{$nextItem = $record->nextItem();}}

{{if $nextItem !== NULL}}
	<a href="{$nextItem->url()}">{$nextItem->_title}</a>
{{endif}}

But yes, it adds one database query. And I do not know if this has performance issues on larger installations. It is also possible to add a "?do=next" as a plugin, where you won't have that extra query unless you click the link.

EDIT: Was not aware of the issues expressed in the topic @Meddysong linked to. It's not as straight forward as I thought. 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...