Jump to content

Next Database Record

Featured Replies

Posted

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.

  • Community Expert

Needs a manual database query. You can’t get it as easily as next unread. 

Adriano seemed to find a solution once but it's too technical for me to be able to do:

 

{{$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. 

Archived

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

Recently Browsing 0

  • No registered users viewing this page.