Next / Previous pages

Post Reply
User avatar
bayerberg
Master Bludit
Posts: 121
Joined: Wed Jun 07, 2017 1:05 pm
Contact:

Sun Jan 12, 2020 9:48 pm

I'm doing next/ previous pages this way

Code: Select all

echo'<div class="row">';

	$previousPageKey = $page->previousKey();
	$previousPage = buildPage($previousPageKey);
	$nextPageKey = $page->nextKey();
	$nextPage = buildPage($nextPageKey);

	echo'<div class="six columns center-text">';
	echo '<p class="title">Next post: <br/>  ';
	if ($page->nextKey()) {
		echo'&#8729; <a href="'.$nextPage->permalink().'">'.$nextPage->title().'</a>';
		echo'<div class="hovering-button left"><a href="'.$nextPage->permalink().'" >&laquo;</a></div>';
	} else {
	echo 'Hold your horses, this is the latest post';
	}
	echo'</p>';
	echo'</div>';
	echo'<div class="six columns center-text">';
	echo '<p class="title">Previous post: <br/> &#8729; ';
	if ($page->previousKey()){
		echo'<a href="'.$previousPage->permalink().'">'.$previousPage->title().'</a>';
		echo'<div class="hovering-button right"><a href="'.$previousPage->permalink().'" >&raquo;</a></div>';
		} else {
		echo ' No more posts. You reached the end.';
	}
	echo'</p>';
	echo'</div>';
	
echo'</div>';
and sometimes I wont get either one. Whats the issue? Looks ok to me...
bludit plugins and themes - makeitblu | I do things, check them out on behance | check out startups undiluted - london's startup ecosystem
User avatar
bayerberg
Master Bludit
Posts: 121
Joined: Wed Jun 07, 2017 1:05 pm
Contact:

Fri Jan 31, 2020 12:44 am

Managed to track down the issue - it has to do something with a date and how its being set. Theres a time difference between my server and what Bludit sets on published posts. Any help?
bludit plugins and themes - makeitblu | I do things, check them out on behance | check out startups undiluted - london's startup ecosystem
User avatar
Edi
Site Admin
Posts: 1711
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Fri Jan 31, 2020 8:30 pm

bayerberg wrote:
Fri Jan 31, 2020 12:44 am
Theres a time difference between my server and what Bludit sets on published posts.
What is the difference? What about setting another time zone in Bludit?
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
User avatar
bayerberg
Master Bludit
Posts: 121
Joined: Wed Jun 07, 2017 1:05 pm
Contact:

Fri Jan 31, 2020 10:17 pm

its not a timezone issue. time difference is around 20 minutes. it happens both on a local server and online.
bludit plugins and themes - makeitblu | I do things, check them out on behance | check out startups undiluted - london's startup ecosystem
User avatar
diego
Site Admin
Posts: 720
Joined: Sat May 16, 2015 2:53 pm
Contact:

Tue Feb 04, 2020 9:35 am

Hi,
maybe there is a bug on the function next and prev pages, I will check.
Have you tried to print the values or make a small example, I mean create 4 pages and check if the values returned is correct?
User avatar
diego
Site Admin
Posts: 720
Joined: Sat May 16, 2015 2:53 pm
Contact:

Tue Feb 04, 2020 12:19 pm

I tried the functions and works fines.

Code: Select all

<?php
if ($WHERE_AM_I=='page') {
	if ($page->nextKey()) {
		$nextPage = buildPage($page->nextKey());
		echo "The title of the next page: ".$nextPage->title().'<br>';
	} else {
		echo "There is not next page.".'<br>';
	}
	
	if ($page->previousKey()) {
		$prevPage = buildPage($page->previousKey());
		echo "The title of the previous page: ".$prevPage->title().'<br>';
	} else {
		echo "There is not previous page.".'<br>';
	}
}
?>
User avatar
bayerberg
Master Bludit
Posts: 121
Joined: Wed Jun 07, 2017 1:05 pm
Contact:

Thu Feb 06, 2020 2:57 pm

thanks for checking. the bug is there somewhere :) i get the issue quite often, dont have a clue why it happens though. ill post up the example when it happens.
bludit plugins and themes - makeitblu | I do things, check them out on behance | check out startups undiluted - london's startup ecosystem
Post Reply