DMXzone App Connect Support Product Page

How do I create next and previous details page buttons?

Asked 02 Oct 2019 16:02:40
has this question
02 Oct 2019 16:02:40 Bruce Wilkie posted:
Hi there

I've got a news detials page set up which I'm filtering by url parameter (newsid).

I've also got a news list page with a paged query query and next/previous buttons on that with 12 records set as the limit.

What I'm wanting to do is add next/previous buttons to the news details page so that site visitors can go straight to the next or previous news item, in ordered by newsdate DESC, newsid DESC.

How would I go about this?

thanks in advance


Replied 03 Oct 2019 09:24:58
03 Oct 2019 09:24:58 Teodor Kuduschiev replied:
Hello Bruce,
There is not an out of the box way of doing that.
Probably you will need a separate database query for this, to check for the next record id and bind it in the "next" and "previous" links.

Never actually tested such a case.
Replied 03 Oct 2019 09:30:30
03 Oct 2019 09:30:30 Bruce Wilkie replied:
OK, thanks Teodor. If I figure out a way to do it I'll let you know

Replied 03 Oct 2019 10:25:00
03 Oct 2019 10:25:00 Bruce Wilkie replied:
Hi again Teodor

Looked at being fancy by creating a paged query with a limit of 1, but I need to pass the record id with the next and previous buttons so it got really complicated very fast.

Going back to your idea about a second database query. Should be straight forward, but how do I go about including the current record id ('newsid'), and date ('newsdate') in the second query? Tried a few things but getting nowhere. Assuming I need to store it in a variable somehow. newsid is in the querystring of the page, but date isn't so cant use GET variable. Would I use session variables instead and if so how?


Reply to this topic