Member
Member
frankm   2011-02-10, 06:24
#1

hi,

i am a bit puzzled about the hasNextPage function in the search context.

here is what i do. i have set my image number per page to 9. my search returns 26 matches. that is 3 pages (9+9+8).

what i do to display the images is a loop using next_image(false,9). i specify 9 otherwise the loop outputs 10 images which is incompatible with my theme. doing this i get 9 images on the first page. good.

at the bottom of the page i put some pagination link like this
if ( hasNextPage() ) { printNextPageLink('Next Page >'); }. on the first page do get the NEXT link. good.

if i click on the pagination link i end up on the second page of the search result (url page/search/keyword/2). there i see 9 images because of my theme but if i look at the code source there are actually 10 images listed. so i definitely miss 1 image that is not going to be displayed on the third page. and also what is weird is that for some reason the hasNextPage() function returns FALSE. i don't understand because if I print the current page number (getCurrentPage()) it says 2 and the total page number (getTotalPages()) says 3.

am i doing something wrong here ?

thank you,
frank.

Member
Member
frankm   2011-02-10, 07:33
#2

FYI, in the theme option i have the Images: thumbnails per page set to 9. options have been applied. but if i echo getOption('images_per_page') i get 10 instead of 9.

Member
Member
frankm   2011-02-10, 07:39
#3

although i do not explicitly use images_per_row in my theme page, the option has to match the design otherwise it gets screwed. there must be some internal checks or calculations. anyway the next_image issue is fixed. i am left with the hasNextPage returning FALSE when it should be TRUE.

i'm sure i am doing something wrong somewhere but i can't find what. if you can point me to a direction that would be awesome.

Administrator
Administrator
acrylian   2011-02-10, 09:54
#4

Just to answer I have no idea right now. sbillard is the expert on the search engine anyway.

Member
Member
sbillard   2011-02-10, 21:12
#5

All the information on thumbs per page and per row must match your layout. Otherwise things just do not work. These data are used when computing things like # pages, etc.

Member
Member
frankm   2011-02-11, 00:23
#6

thanks. i found that out. i didn't realize it was actually used since i didn't refer to these options myself. once this done i also had to return the next_image call to next_image(false) (and not next_image(false, 9) to get the pagination to work properly. all is working now.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.