This is my page called page.php along with the code:
PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'Page'); // change this depending on your filename
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array(
);
// get special data templates from the datastore
$specialtemplates = array(
);
// pre-cache templates used by all actions
$globaltemplates = array(
'alphamenu',
);
// pre-cache templates used by specific actions
$actiontemplates = array(
//****Beginning Page Navigation ***//
// Default page variables
$perpage = $vbulletin->input->clean_gpc('r', 'perpage', TYPE_UINT);
$pagenumber = $vbulletin->input->clean_gpc('r', 'pagenumber', TYPE_UINT);
// Count all log entries
$itemcount = $db->query_first("
SELECT COUNT(uid) AS itemcount
FROM " . TABLE_PREFIX . "thread WHERE title LIKE '" . $letter . "%'");
if ($itemcount['itemcount'] == 0) { // Show if recordset empty
$emptysearch=true; // With this, you can easily create a condition in the template to show NO ITEMS message
} // Show if recordset empty
// Make sure all these variables are cool
sanitize_pageresults($itemcount['itemcount'], $pagenumber, $perpage, 10, 25); //Change 8 to as many records you want to show per page
// Default lower and upper limit variables
$limitlower = ($pagenumber - 1) * $perpage + 1;
$limitupper = $pagenumber * $perpage;
if ($limitupper > $itemcount['itemcount'])
{
// Too many for upper limit
$limitupper = $itemcount['itemcount'];
if ($limitlower > $itemcount['itemcount'])
{
// Too many for lower limit
$limitlower = $itemcount['itemcount'] - $perpage;
}
}
if ($limitlower <= 0)
{
// Can't have negative or null lower limit
$limitlower = 1;
}
eval('$alphamenu .= "' . fetch_template('alphamenu') . '";'); //Use this line of code to show alphamenu in any sub-page you want. Then simply use $alphamenu variable in the associated template.
$query_Searchltr=$db->query_read("SELECT * from " . TABLE_PREFIX . "thread WHERE title LIKE '" . $letter . "%' LIMIT " . ($limitlower - 1) . ", $perpage"); //Change colname to the same column name you had set in the above count query
while ($search_result = $db->fetch_array($query_Searchltr))
{
$row_id=$search_result['uid'];
$row_name=$search_result['name'];
$row_class=$search_result['class'];
// and so on...
}
// Finally construct the page nav
$pagenav = construct_page_nav($pagenumber, $perpage, $itemcount['itemcount'], 'page.php?do=alphasearch' . $vbulletin->session->vars['sessionurl'] . '&ltr=' . $letter);
//****End Page Navigation******//
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('mysearchbits') . '");'); //The main output prints on mysearchbits template, so create it and use variables defined within the while loop above for results
$db->free_result($query_Searchltr);
}