Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small improvement #2

Open
eldhosejoys opened this issue Sep 1, 2020 · 2 comments
Open

small improvement #2

eldhosejoys opened this issue Sep 1, 2020 · 2 comments

Comments

@eldhosejoys
Copy link

If you could add

$pages = ceil( $total / $limit );

$stop = $page + 4;
if($stop > $pages){$stop = $pages;}
$starter = $page - 4 ;
if($starter <= 0){$starter = 1 ;}

$Previous = $page - 1;

Then in the for loop condition of the pagination

for($i = $starter ; $i<= $stop ; $i++)

I think it is a little better. What do you think?

@eldhosejoys
Copy link
Author

eldhosejoys commented Sep 1, 2020

Also, you could add an if condition to show next and previous buttons.

$num = 4   //depends on your choice of limit.
if($Previous > $num){
//show previous button.
}
if($Next < $pages){   //also you can do $pages-4 according to your limit
//show next button.
}

@EduVillas
Copy link

Also, you could add an if condition to show next and previous buttons.

$num = 4   //depends on your choice of limit.
if($Previous > $num){
//show previous button.
}
if($Next < $pages){   //also you can do $pages-4 according to your limit
//show next button.
}

Can you please be more specific?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants