本文整理汇总了PHP中paging::startPaging方法的典型用法代码示例。如果您正苦于以下问题:PHP paging::startPaging方法的具体用法?PHP paging::startPaging怎么用?PHP paging::startPaging使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paging
的用法示例。
在下文中一共展示了paging::startPaging方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showTable
function showTable()
{
global $error_msg;
global $report_msg;
global $warning_msg_displayed;
global $num_ajaxCRUD_tables_instantiated;
$num_ajaxCRUD_tables_instantiated++;
/* Sort Table
Note: this cancels out default sorting set by addOrderBy()
*/
if ($this->db_table == $_REQUEST['table'] && $_REQUEST['sort_field'] != '') {
$sort_field = $_REQUEST['sort_field'];
$user_sort_order_direction = $_REQUEST['sort_direction'];
if ($user_sort_order_direction == 'asc') {
$this->sort_direction = "desc";
} else {
$this->sort_direction = "asc";
}
$sort_sql = " ORDER BY {$sort_field} {$this->sort_direction}";
$this->addOrderBy($sort_sql);
$this->sorted_table = true;
}
//the HTML to display
$top_html = "";
//top header stuff
$table_html = "";
//for the html table itself
$bottom_html = "";
$add_html = "";
//for the add form
$html = "";
//all combined
if ($num_ajaxCRUD_tables_instantiated == 1) {
//pull in the css and javascript files
$this->insertHeader($this->ajax_file);
}
if ($this->doActionOnShowTable) {
if ($_REQUEST['action'] != '') {
$this->doAction($_REQUEST['action']);
}
}
$item = $this->item;
$top_html .= "<a name='ajaxCRUD" . $num_ajaxCRUD_tables_instantiated . "' id='ajaxCRUD" . $num_ajaxCRUD_tables_instantiated . "'></a>\n";
if (count($this->ajaxFilter_fields) > 0) {
$top_html .= "<form id=\"" . $this->db_table . "_filter_form\">\n";
$top_html .= "<table cellspacing='5' align='center'><tr>";
foreach ($this->ajaxFilter_fields as $filter_field) {
$display_field = $filter_field;
if ($this->displayAs_array[$filter_field] != '') {
$display_field = $this->displayAs_array[$filter_field];
}
$textbox_size = $this->ajaxFilterBoxSize[$filter_field];
$filter_value = "";
if ($_REQUEST[$filter_field] != '') {
$filter_value = $_REQUEST[$filter_field];
}
$top_html .= "<td><b>{$display_field}</b>: <input type=\"text\" size=\"{$textbox_size}\" name=\"{$filter_field}\" value=\"{$filter_value}\" onKeyUp=\"filterTable(this, '" . $this->db_table . "', '{$filter_field}', '{$extra_query_params}');\"></td>";
}
$top_html .= "</tr></table>\n";
$top_html .= "</form>\n";
}
#############################################
#
# Begin code for displaying database elements
#
#############################################
$select_fields = implode(",", $this->fields);
$sql = "SELECT * FROM " . $this->db_table . $this->sql_where_clause . $this->sql_order_by;
if ($this->showPaging) {
$pageid = $_GET['pid'];
//Get the pid value
if (intval($pageid) == 0) {
$pageid = 1;
}
$Paging = new paging();
$Paging->tableName = $this->db_table;
$total_records = $Paging->myRecordCount($sql);
//count records
$totalpage = $Paging->processPaging($this->limit, $pageid);
$rows = $Paging->startPaging($sql);
//get records in the databse
$links = $Paging->pageLinks(basename($PHP_SELF));
//1234 links
unset($Paging);
} else {
$rows = q($sql . $this->sql_limit);
}
//$rows = q("SELECT * FROM " . $this->db_table");
$row_count = count($rows);
$this->row_count = $row_count;
$_SESSION['row_count'] = $row_count;
if ($row_count == 0) {
$report_msg[] = $this->emptyTableMessage;
}
#this is an optional function which will allow you to display errors or report messages as desired. comment it out if desired
//only show the message box if it hasn't been displayed already
if ($warning_msg_displayed == 0 || $warning_msg_displayed == '') {
echo_msg_box();
}
$dropdown_array = array();
//.........这里部分代码省略.........
示例2: showTable
//.........这里部分代码省略.........
$customClass = $this->display_field_with_class_style[$filter_field];
}
$top_html .= "<input type=\"text\" class=\"{$customClass}\" size=\"{$textbox_size}\" name=\"{$filter_field}\" value=\"{$filter_value}\" onKeyUp=\"filterTable(this, '" . $this->db_table . "', '{$filter_field}', '{$extra_query_params}');\">";
}
}
}
$top_html .= " </th>";
}
$top_html .= "</tr></thead></table>\n";
$top_html .= "</form>\n";
}
#############################################
#
# Begin code for displaying database elements
#
#############################################
$select_fields = implode(",", $this->fields);
$sql = "SELECT * FROM " . $this->db_table . $this->sql_where_clause . $this->sql_order_by;
//added name for table (t) in case where clauses want to use it (7.2.2)
if ($this->showPaging) {
$pageid = "";
if (isset($_REQUEST['pid'])) {
$pageid = $_REQUEST['pid'];
//Get the pid value
}
if (intval($pageid) == 0) {
$pageid = 1;
}
$Paging = new paging();
$Paging->tableName = $this->db_table;
$total_records = $Paging->myRecordCount($sql);
//count records
$totalpage = $Paging->processPaging($this->limit, $pageid);
$rows = $Paging->startPaging($sql);
//get records in the databse
$links = $Paging->pageLinks(basename($_SERVER['PHP_SELF']));
//1234 links
unset($Paging);
} else {
$rows = q($sql . $this->sql_limit);
}
//echo $sql;
//$row_count = count($rows); //count should NOT consider paging
$row_count = $this->getNumRows();
$this->row_count = $row_count;
$_SESSION['row_count'] = $row_count;
//DEPRECATED
$_SESSION[$this->db_table . '_row_count'] = $row_count;
if ($row_count == 0) {
$report_msg[] = $this->emptyTableMessage;
}
#this is an optional function which will allow you to display errors or report messages as desired. comment it out if desired
//only show the message box if it hasn't been displayed already
if ($warning_msg_displayed == 0 || $warning_msg_displayed == '') {
echo_msg_box();
}
$top_html .= "<div id='{$this->db_table}'>\n";
if ($row_count > 0) {
/*
commenting out the 'edit item' text at the top; feel free to add back in if you want
$edit_word = "Edit";
if ($row_count == 0) $edit_word = "No";
$top_html .= "<h3>Edit " . $this->item_plural . "</h3>\n";
*/
//for vertical display, have a little spacing in there
if ($this->orientation == 'vertical' && $this->cellspacing == "") {