Link to show older navigation button is not getting visible
dev8546 opened this issue · 1 comments
I have seen that if we go beyond the page per blog. Older navigation option does not appear. The reason what I found is to do with this code
int pageCount; pageCount = int.TryParse(ViewData[Constants.TotalPostCount].ToString(), out pageCount) ? 0 : pageCount / 2;
Here we can see if TryParse is true, pageCount is always getting set to 0. Not sure what is that way and even what is the logic behind putting the hard coded value of 2 in pageCount/2.
This is the code what I think should work
int pageCount; pageCount = int.TryParse(ViewData[Foodzy.Utility.Blog.Constants.TotalPostCount].ToString(), out pageCount) ? (pageCount - 1) / settings.Value.PostsPerPage : 0;
//pageCount = int.TryParse(ViewData[Constants.TotalPostCount].ToString(), out pageCount) ? 0 : pageCount / 2;
pageCount = int.TryParse(ViewData[Constants.TotalPostCount].ToString(), out pageCount) ? (pageCount - 1) / settings.Value.PostsPerPage : 0;
Thanks. I implemented this and it appears to work now.