View Full Version : vb's page nav
AN-net
07-09-2004, 11:34 PM
hi, well im sort of confused on how to correctly use this feature and exactly what function to do, i have used it before and it did not work correctly for me.
can someone show me how to use it:)
Jolten
07-09-2004, 11:45 PM
What are you talking about?
Zachery
07-09-2004, 11:51 PM
What are you talking about?
Im with Jolten on this one
AN-net
07-09-2004, 11:54 PM
vb's pagination function:) i hope you know zac cause its a built in vb feature;)
Zachery
07-09-2004, 11:55 PM
vb's pagination function:) i hope you know zac cause its a built in vb feature;)
Oh that thing, it runs a query on the table, whichever it may be and finds out how many pages there should be links to, i think :)
AN-net
07-10-2004, 12:03 AM
could you post an example code:), i always mess this up:D
Jolten
07-10-2004, 12:04 AM
ooo.. okay.. yeah.. that thing.. :)
AN-net
07-10-2004, 01:57 AM
im getting division by zero on 1707 in /includes/functions.php
my code is:
$countj= $DB_site->query_first("SELECT COUNT(*) AS journals FROM ".TABLE_PREFIX."journals WHERE active='1'");
$pgnav= construct_page_nav($countj[journals], journal.php);
i think did it right and for the page nav being displayed it says "Page of 0"
AN-net
07-10-2004, 07:01 PM
ok i fixed the division by zero part but im still experiencing alot of problems, first off it doesnt say which page i am on currently it just says page blank of 2. secondly if it goes past 3 page it doesnt show the 3rd one and if your on page 2 the next arrow leads you back to page 1. what did i do wrong:(
my code:
$countj= $DB_site->query_first("SELECT COUNT(*) AS journals FROM ".TABLE_PREFIX."journals WHERE active='1'");
$perpage= 1;
if(empty($page))
{
$page= 1;
}
$start= (($page * $perpage) - $perpage);
$pgnav= construct_page_nav($countj[journals], "journal.php?", "pp=$perpage");
$fjournals= $DB_site->query("SELECT
journals.journal_id,journals.journalname,journals. journaldesc,
journals.journalist,journals.journalist_id,journal s.lastentry,
journals.lastentry_date,journals.lastentry_id,jour nals.journalviews,
journals.journal_totalrating AS totalrating,journals.journal_totalvotes AS totalvotes,COUNT(journal_entries.entry_id) AS entries
FROM ".TABLE_PREFIX."journals
LEFT JOIN journal_entries
ON (journals.journal_id=journal_entries.journal_id AND entry_active=1)
WHERE journals.active='1'
GROUP BY journals.journal_id
LIMIT $start,$perpage
");
AN-net
07-10-2004, 10:17 PM
i am still experiencing problems i need help:)
here is my updated code:
$countj= $DB_site->query_first("SELECT COUNT(*) AS journals FROM ".TABLE_PREFIX."journals WHERE active='1'");
$perpage= 2;
if(empty($page))
{
$page= 1;
}
$pagenumber = $page+1;
if ($pagenumber < 1)
{
$pagenumber = 1;
}
else if ($pagenumber > $countj['journals'])
{
$pagenumber = $countj['journals'];
}
$start= (($page * $perpage) - $perpage);
$pgnav= construct_page_nav($countj['journals'], "journal.php?", "&pp=$perpage");
$fjournals= $DB_site->query("SELECT
journals.journal_id,journals.journalname,journals. journaldesc,
journals.journalist,journals.journalist_id,journal s.lastentry,
journals.lastentry_date,journals.lastentry_id,jour nals.journalviews,
journals.journal_totalrating AS totalrating,journals.journal_totalvotes AS totalvotes,COUNT(journal_entries.entry_id) AS entries
FROM ".TABLE_PREFIX."journals
LEFT JOIN journal_entries
ON (journals.journal_id=journal_entries.journal_id AND entry_active=1)
WHERE journals.active='1'
GROUP BY journals.journal_id
LIMIT $start,$perpage
");
it seems as though my page is messing me up, it seems as though it affects my $start variable when i use ++ or +1 in the defining of $pagenumber. can someone help me define $pagenumber correctly ;)
AN-net
07-11-2004, 12:00 AM
i figured this out my self
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.