View Full Version : Small pagination problem
veenuisthebest
08-02-2008, 04:39 AM
please check this page (http://www.vinayaks.com/testvb/links.php) and perform category search at the bottom with "Chats and Forums".
1. I am limiting 8 records to show on the search results per page. But the categories that have more than 8 records (for ex. Chats and Forums) do show the navigation bar, counts the records BUT on click/navigate, it shows empty. I think its loosing the session somehow. This is what I am doing to construct page nav:-
//construct the page nav
$pagenav = construct_page_nav($pagenumber, $perpage, $linkcount['linkcount'], 'links.php?do=search' . $vbulletin->session->vars['sessionurl'] . '&view');
//End construct page nav
2. Also, how can I carry the search results form data to the next page ? Currently it resets on every page load.
Please test the above problems here (http://www.vinayaks.com/testvb/links.php)
Thank You
Lynne
08-02-2008, 02:12 PM
It seems to be working for me. Did you fix it?
veenuisthebest
08-02-2008, 03:12 PM
it isn't working fine !! I think you are talking about the main links page. Its fine there.
The problem is at the search results page. Just make a search for "Chats and Forums" category and then try to navigate, you would notice the second page says empty which actually isn't.
Thanks
Lynne
08-02-2008, 03:52 PM
Ah, OK. Notice the link when you go to page 2: http://www.vinayaks.com/testvb/links.php?do=search&view&page=2 You are not passing anything for view. I think, though, you need to pass the category id somehow - set it as a hidden input?
veenuisthebest
08-02-2008, 03:56 PM
ya.. but how do i append the category ID to the URL ??
--------------- Added 1217696802 at 1217696802 ---------------
I am sure it has to do something with this
$pagenav = construct_page_nav($pagenumber, $perpage, $linkcount['linkcount'], 'links.php?do=search' . $vbulletin->session->vars['sessionurl'] . '&view');
Lynne
08-02-2008, 04:14 PM
What is the variable name you are using for the category? I think you want to put that instead of the 'view' in your line. Something like "&category=Chats%20and%20Forums" ? You also need to pass the parameter for descending/ascending.
(Sorry veenu, forms aren't my strongpoint. I think I've said before that I code by trial and error. :/ )
veenuisthebest
08-02-2008, 04:32 PM
even I code by trial and error lol ;)
see variable name is $searchcat that contains the category name that is searched for on links.php?do=search
I understand what I wanna do but not able to append category name. When I am putting something like $amp;category=$searchcat , it displays the variable name instead.
I then created a hidden field $searched to store the value of $searchcat, and I notice in source code that it does contain the searched value, but still it shows just the variable instead of the value in the URL.
Thanks
MoT3rror
08-02-2008, 04:58 PM
Well in your first post you had this code.
$pagenav = construct_page_nav($pagenumber, $perpage, $linkcount['linkcount'], 'links.php?do=search' . $vbulletin->session->vars['sessionurl'] . '&view');
Which view is being put at the end of the url then vbulletin will add the &page=X. So if you aren't using view you can just remove &view. If you want to use view just do something like this.
$pagenav = construct_page_nav($pagenumber, $perpage, $linkcount['linkcount'], 'links.php?do=search' . $vbulletin->session->vars['sessionurl'] . '&view=' . $variable);
Also here is a article if you haven't found it yet. (https://vborg.vbsupport.ru/showthread.php?t=120540&highlight=page)
veenuisthebest
08-02-2008, 05:07 PM
thanks for replying.. well I had already gone through that article..
//construct page nav
$pagenav = construct_page_nav($pagenumber, $perpage, $linkcount['linkcount'], 'links.php?do=search' . $vbulletin->session->vars['sessionurl'] . '&view=' . $searchcat);
//end construct page nav
This code helped me to append the category to the URL.. but still can't make it to view that second page.. please check it once again.
Thanks
--------------- Added 1217701132 at 1217701132 ---------------
ahhh... got it !!! DONE :up:
Now, last thing:-
How do I carry the search data onto the next page ?? say I searched for "Chats and Forums" in "Ascending" , so I want that both should be selected on the next page and should not reset to default.
Thanks
Lynne
08-02-2008, 05:51 PM
Are you using searchid at all? If so, that has those variables in it (this is how vb does it). Or, I suppose you can either a)pass them in the url in your "construct_page_nav" call, or b)make them hidden and then make sure you grab them, and spit them out as hidden again, in your search page.
veenuisthebest
08-02-2008, 05:57 PM
no.. i am not using searchid at all ! ... will try these methods..:)
one more thing plzz..
How do I search for some text ??? Say, we add a site with all the details.. Now I want to search with keyword "Tech555" and I want that all the sites that has this term in any of their fields should retrieve.
Thank you
Lynne
08-02-2008, 06:37 PM
You would add another input field to your links.php form to include the keyword. Then, in your query, you would add in the search for that keyword in the correct column.
veenuisthebest
08-02-2008, 07:10 PM
ofcourse we'd be adding a input field..
i was asking for query only !
will it be something like this?
SELECT * from mytable WHERE sitetitle LIKE '%$keyword%';
where $keyword is the variable that contains the search value.
Thanks
Lynne
08-02-2008, 07:19 PM
I think you want to do it like:
$query="SELECT * from mytable WHERE sitetitle LIKE '%" . $keyword . "%'";
veenuisthebest
08-02-2008, 07:26 PM
ahh... thank you so much ! you're so nice..
How does it look now ? I also removed that table border look.
http://www.tech555.com/forum/links.php
Lynne
08-02-2008, 08:08 PM
It's looking really nice!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.