当前位置: 首页>>代码示例>>PHP>>正文


PHP Paginate::show_links方法代码示例

本文整理汇总了PHP中Paginate::show_links方法的典型用法代码示例。如果您正苦于以下问题:PHP Paginate::show_links方法的具体用法?PHP Paginate::show_links怎么用?PHP Paginate::show_links使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Paginate的用法示例。


在下文中一共展示了Paginate::show_links方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: count

 /** ----------------------------------------
     /**  Browse Avatars
     /** ----------------------------------------*/
 function browse_avatars()
 {
     global $IN, $DSP, $DB, $LANG, $PREFS, $SESS, $FNS;
     if (FALSE === ($id = $this->auth_id())) {
         return $DSP->no_access_message();
     }
     /** ----------------------------------------
     		/**  Are avatars enabled?
     		/** ----------------------------------------*/
     if ($PREFS->ini('enable_avatars') == 'n') {
         return $DSP->error_message($LANG->line('avatars_not_enabled'));
     }
     /** ----------------------------------------
     		/**  Define the paths and get the avatars
     		/** ----------------------------------------*/
     $avatar_path = $PREFS->ini('avatar_path', TRUE) . $FNS->filename_security($IN->GBL('folder')) . '/';
     $avatar_url = $PREFS->ini('avatar_url', TRUE) . $FNS->filename_security($IN->GBL('folder')) . '/';
     $avatars = $this->_get_avatars($avatar_path);
     /** ----------------------------------------
     		/**  Did we succeed?
     		/** ----------------------------------------*/
     if (count($avatars) == 0) {
         return $DSP->error_message($LANG->line('avatars_not_found'));
     }
     /** ----------------------------------------
     		/**  Pagination anyone?
     		/** ----------------------------------------*/
     $pagination = '';
     $max_rows = 2;
     $max_cols = 3;
     $col_ct = 0;
     $perpage = $max_rows * $max_cols;
     $total_rows = count($avatars);
     $rownum = $IN->GBL('row') == '' ? 0 : $IN->GBL('row');
     $base_url = BASE . AMP . 'C=myaccount' . AMP . 'M=browse_avatars' . AMP . 'id=' . $id . AMP . 'folder=' . $IN->GBL('folder');
     if ($rownum > count($avatars)) {
         $rownum = 0;
     }
     if ($total_rows > $perpage) {
         $avatars = array_slice($avatars, $rownum, $perpage);
         if (!class_exists('Paginate')) {
             require PATH_CORE . 'core.paginate' . EXT;
         }
         $PGR = new Paginate();
         $PGR->base_url = $base_url;
         $PGR->first_url = $base_url;
         $PGR->qstr_var = 'row';
         $PGR->total_count = $total_rows;
         $PGR->per_page = $perpage;
         $PGR->cur_page = $rownum;
         $pagination = $PGR->show_links();
         // We add this for use later
         if ($rownum != '') {
             $base_url .= $rownum . '/';
         }
     }
     /** ----------------------------------------
     		/**  Build the table rows
     		/** ----------------------------------------*/
     $avstr = '';
     foreach ($avatars as $image) {
         if ($col_ct == 0) {
             $avstr .= "<tr>\n";
         }
         $avstr .= "<td align='center'><img src='" . $avatar_url . $image . "' border='0' /><br /><input type='radio' name='avatar' value='" . $image . "' /></td>\n";
         $col_ct++;
         if ($col_ct == $max_cols) {
             $avstr .= "</tr>";
             $col_ct = 0;
         }
     }
     if ($col_ct < $max_cols and count($avatars) >= $max_cols) {
         for ($i = $col_ct; $i < $max_cols; $i++) {
             $avstr .= "<td>&nbsp;</td>\n";
         }
         $avstr .= "</tr>";
     }
     if (!preg_match("#\\<\\/tr\\>\$#i", $avstr)) {
         $avstr .= "</tr>";
     }
     /** ----------------------------------------
     		/**  Finalize the output
     		/** ----------------------------------------*/
     $title = $LANG->line('browse_avatars');
     $r = $DSP->form_open(array('action' => 'C=myaccount' . AMP . 'M=select_avatar')) . $DSP->input_hidden('id', $id) . $DSP->input_hidden('folder', $IN->GBL('folder'));
     $r .= $DSP->table('tableBorder', '0', '10', '100%') . $DSP->tr() . $DSP->td('tableHeading');
     $r .= $title;
     $r .= $DSP->td_c() . $DSP->tr_c();
     $avstr = $DSP->table('', '0', '10', '100%') . $avstr . $DSP->table_c();
     $r .= $DSP->tr();
     $r .= $DSP->table_qcell('tableCellOne', $avstr);
     $r .= $DSP->tr_c();
     if ($pagination != '') {
         $r .= $DSP->tr();
         $r .= $DSP->table_qcell('tableCellOne', $DSP->qdiv('defaultCenter', $pagination));
         $r .= $DSP->tr_c();
     }
//.........这里部分代码省略.........
开发者ID:jlleblanc,项目名称:ConnectBoom,代码行数:101,代码来源:cp.myaccount.php

示例2: array

    /** ----------------------------------------
    /**  Browse Avatars
    /** ----------------------------------------*/
	
	function browse_avatars()
	{
		global $DB, $LANG, $PREFS, $SESS, $FNS;
		
		/** ----------------------------------------
		/**  Are avatars enabled?
		/** ----------------------------------------*/
		
		if ($PREFS->ini('enable_avatars') == 'n')
		{
			return $this->_trigger_error('edit_avatar', 'avatars_not_enabled');
		}
	
		/** ----------------------------------------
		/**  Define the paths
		/** ----------------------------------------*/
		
		$avatar_path = $PREFS->ini('avatar_path', TRUE).$this->cur_id.'/';
		$avatar_url  = $PREFS->ini('avatar_url', TRUE).$this->cur_id.'/';
		
		/** ----------------------------------------
		/**  Is this a valid avatar folder?
		/** ----------------------------------------*/
		
		$extensions = array('.gif', '.jpg', '.jpeg', '.png');

		if ( ! @is_dir($avatar_path) OR ! $fp = @opendir($avatar_path))
		{
			return $this->_trigger_error('edit_avatar', 'avatars_not_found');
		}
		
		/** ----------------------------------------
		/**  Grab the image names
		/** ----------------------------------------*/

		$avatars = array();

		while (FALSE !== ($file = readdir($fp))) 
		{ 
			if (FALSE !== ($pos = strpos($file, '.')))
			{
				if (in_array(substr($file, $pos), $extensions))
				{
					$avatars[] = $file;
				}
			}							
		}
		
		closedir($fp); 
		
		/** ----------------------------------------
		/**  Did we succeed?
		/** ----------------------------------------*/
		
		if (count($avatars) == 0)
		{
			return $this->_trigger_error('edit_avatar', 'avatars_not_found');
		}
		
		/** ----------------------------------------
		/**  Pagination anyone?
		/** ----------------------------------------*/
	
		$pagination = '';
		$max_rows	= 8;
		$max_cols	= 3;
		$col_ct		= 0;
		$perpage 	= $max_rows * $max_cols;
		$total_rows = count($avatars);
		$rownum 	= ($this->uri_extra == '') ? 0 : $this->uri_extra;
		$base_url	= $this->_member_path('browse_avatars/'.$this->cur_id.'/');
		
		if ($rownum > count($avatars)) 
			$rownum = 0;
				
		if ($total_rows > $perpage)
		{		
			$avatars = array_slice($avatars, $rownum, $perpage);
			
			if ( ! class_exists('Paginate'))
			{
				require PATH_CORE.'core.paginate'.EXT;
			}
			
			$PGR = new Paginate();
				
			$PGR->path			= $base_url;
			$PGR->prefix		= '';
			$PGR->total_count 	= $total_rows;
			$PGR->per_page		= $perpage;
			$PGR->cur_page		= $rownum;			
			$pagination	= $PGR->show_links();
			
			// We add this for use later
			
			if ($rownum != '')
//.........这里部分代码省略.........
开发者ID:jmelton,项目名称:eb,代码行数:101,代码来源:mod.member_images.php

示例3: array

 /** ----------------------------------------
     /**  Show search results
     /** ----------------------------------------*/
 function search_results()
 {
     global $IN, $DB, $TMPL, $LANG, $FNS, $OUT, $LOC, $PREFS, $REGX;
     /** ----------------------------------------
         /**  Fetch the search language file
         /** ----------------------------------------*/
     $LANG->fetch_language_file('search');
     /** ----------------------------------------
         /**  Check search ID number
         /** ----------------------------------------*/
     // If the QSTR variable is less than 32 characters long we
     // don't have a valid search ID number
     if (strlen($IN->QSTR) < 32) {
         return $OUT->show_user_error('off', array($LANG->line('search_no_result')), $LANG->line('search_result_heading'));
     }
     /** ----------------------------------------
         /**  Clear old search results
         /** ----------------------------------------*/
     $expire = time() - $this->cache_expire * 3600;
     $DB->query("DELETE FROM exp_search WHERE site_id = '" . $DB->escape_str($PREFS->ini('site_id')) . "' AND search_date < '{$expire}'");
     /** ----------------------------------------
         /**  Fetch ID number and page number
         /** ----------------------------------------*/
     // We cleverly disguise the page number in the ID hash string
     $cur_page = 0;
     if (strlen($IN->QSTR) == 32) {
         $search_id = $IN->QSTR;
     } else {
         $search_id = substr($IN->QSTR, 0, 32);
         $cur_page = substr($IN->QSTR, 32);
     }
     /** ----------------------------------------
         /**  Fetch the cached search query
         /** ----------------------------------------*/
     $query = $DB->query("SELECT * FROM exp_search WHERE search_id = '" . $DB->escape_str($search_id) . "'");
     if ($query->num_rows == 0 or $query->row['total_results'] == 0) {
         return $OUT->show_user_error('off', array($LANG->line('search_no_result')), $LANG->line('search_result_heading'));
     }
     $fields = $query->row['custom_fields'] == '' ? array() : unserialize(stripslashes($query->row['custom_fields']));
     $sql = unserialize(stripslashes($query->row['query']));
     $sql = str_replace('MDBMPREFIX', 'exp_', $sql);
     $per_page = $query->row['per_page'];
     $res_page = $query->row['result_page'];
     /** ----------------------------------------
         /**  Run the search query
         /** ----------------------------------------*/
     $query = $DB->query(preg_replace("/SELECT(.*?)\\s+FROM\\s+/is", 'SELECT COUNT(*) AS count FROM ', $sql));
     if ($query->row['count'] == 0) {
         return $OUT->show_user_error('off', array($LANG->line('search_no_result')), $LANG->line('search_result_heading'));
     }
     /** ----------------------------------------
         /**  Calculate total number of pages
         /** ----------------------------------------*/
     $current_page = $cur_page / $per_page + 1;
     $total_pages = intval($query->row['count'] / $per_page);
     if ($query->row['count'] % $per_page) {
         $total_pages++;
     }
     $page_count = $LANG->line('page') . ' ' . $current_page . ' ' . $LANG->line('of') . ' ' . $total_pages;
     /** -----------------------------
        	/**  Do we need pagination?
        	/** -----------------------------*/
     // If so, we'll add the LIMIT clause to the SQL statement and run the query again
     $pager = '';
     if ($query->row['count'] > $per_page) {
         if (!class_exists('Paginate')) {
             require PATH_CORE . 'core.paginate' . EXT;
         }
         $PGR = new Paginate();
         $PGR->path = $FNS->create_url($res_page . '/' . $search_id, 0, 0);
         $PGR->total_count = $query->row['count'];
         $PGR->per_page = $per_page;
         $PGR->cur_page = $cur_page;
         $pager = $PGR->show_links();
         $sql .= " LIMIT " . $cur_page . ", " . $per_page;
     }
     $query = $DB->query($sql);
     $output = '';
     if (!class_exists('Weblog')) {
         require PATH_MOD . '/weblog/mod.weblog' . EXT;
     }
     unset($TMPL->var_single['auto_path']);
     unset($TMPL->var_single['excerpt']);
     unset($TMPL->var_single['id_auto_path']);
     unset($TMPL->var_single['full_text']);
     unset($TMPL->var_single['switch']);
     foreach ($TMPL->var_single as $key => $value) {
         if (substr($key, 0, strlen('member_path')) == 'member_path') {
             unset($TMPL->var_single[$key]);
         }
     }
     $weblog = new Weblog();
     // This allows the weblog {absolute_count} variable to work
     $weblog->p_page = $per_page * $current_page - $per_page;
     $weblog->fetch_custom_weblog_fields();
     $weblog->fetch_custom_member_fields();
     $weblog->query = $DB->query($sql);
//.........这里部分代码省略.........
开发者ID:jlleblanc,项目名称:ConnectBoom,代码行数:101,代码来源:mod.search.php

示例4: isset


//.........这里部分代码省略.........
             }
         }
         /** ----------------------------------------
         			/**  Standard pagination - base values
         			/** ----------------------------------------*/
         if ($this->field_pagination == FALSE) {
             if ($this->display_by == '') {
                 if ($count == 0) {
                     $this->sql = '';
                     return;
                 }
                 $this->total_rows = $count;
             }
             if ($this->dynamic_sql == FALSE) {
                 $cat_limit = FALSE;
                 if ((in_array($this->reserved_cat_segment, explode("/", $IN->URI)) and $TMPL->fetch_param('dynamic') != 'off' and $TMPL->fetch_param('weblog')) || (preg_match("#(^|\\/)C(\\d+)#", $IN->URI, $match) and $TMPL->fetch_param('dynamic') != 'off')) {
                     $cat_limit = TRUE;
                 }
                 if ($cat_limit && is_numeric($TMPL->fetch_param('cat_limit'))) {
                     $this->p_limit = $TMPL->fetch_param('cat_limit');
                 } else {
                     $this->p_limit = !is_numeric($TMPL->fetch_param('limit')) ? $this->limit : $TMPL->fetch_param('limit');
                 }
             }
             $this->p_page = $this->p_page == '' || ($this->p_limit > 1 and $this->p_page == 1) ? 0 : $this->p_page;
             if ($this->p_page > $this->total_rows) {
                 $this->p_page = 0;
             }
             $this->current_page = floor($this->p_page / $this->p_limit + 1);
             $this->total_pages = intval(floor($this->total_rows / $this->p_limit));
         } else {
             /** ----------------------------------------
             				/**  Field pagination - base values
             				/** ----------------------------------------*/
             if ($count == 0) {
                 $this->sql = '';
                 return;
             }
             $m_fields = array();
             foreach ($this->multi_fields as $val) {
                 foreach ($this->cfields as $site_id => $cfields) {
                     if (isset($cfields[$val])) {
                         if (isset($query->row['field_id_' . $cfields[$val]]) and $query->row['field_id_' . $cfields[$val]] != '') {
                             $m_fields[] = $val;
                         }
                     }
                 }
             }
             $this->p_limit = 1;
             $this->total_rows = count($m_fields);
             $this->total_pages = $this->total_rows;
             if ($this->total_pages == 0) {
                 $this->total_pages = 1;
             }
             $this->p_page = $this->p_page == '' ? 0 : $this->p_page;
             if ($this->p_page > $this->total_rows) {
                 $this->p_page = 0;
             }
             $this->current_page = floor($this->p_page / $this->p_limit + 1);
             if (isset($m_fields[$this->p_page])) {
                 $TMPL->tagdata = preg_replace("/" . LD . "multi_field\\=[\"'].+?[\"']" . RD . "/s", LD . $m_fields[$this->p_page] . RD, $TMPL->tagdata);
                 $TMPL->var_single[$m_fields[$this->p_page]] = $m_fields[$this->p_page];
             }
         }
         /** ----------------------------------------
         			/**  Create the pagination
         			/** ----------------------------------------*/
         if ($this->total_rows % $this->p_limit) {
             $this->total_pages++;
         }
         if ($this->total_rows > $this->p_limit) {
             if (!class_exists('Paginate')) {
                 require PATH_CORE . 'core.paginate' . EXT;
             }
             $PGR = new Paginate();
             if (!stristr($this->basepath, SELF) and $PREFS->ini('site_index') != '') {
                 $this->basepath .= SELF . '/';
             }
             if ($TMPL->fetch_param('paginate_base')) {
                 $this->basepath = $FNS->create_url($REGX->trim_slashes($TMPL->fetch_param('paginate_base')));
             }
             $first_url = preg_match("#\\.php/\$#", $this->basepath) ? substr($this->basepath, 0, -1) : $this->basepath;
             $PGR->first_url = $first_url;
             $PGR->path = $this->basepath;
             $PGR->prefix = 'P';
             $PGR->total_count = $this->total_rows;
             $PGR->per_page = $this->p_limit;
             $PGR->cur_page = $this->p_page;
             $this->pagination_links = $PGR->show_links();
             if ($this->total_pages * $this->p_limit - $this->p_limit > $this->p_page) {
                 $this->page_next = $this->basepath . 'P' . ($this->p_page + $this->p_limit) . '/';
             }
             if ($this->p_page - $this->p_limit >= 0) {
                 $this->page_previous = $this->basepath . 'P' . ($this->p_page - $this->p_limit) . '/';
             }
         } else {
             $this->p_page = '';
         }
     }
 }
开发者ID:jlleblanc,项目名称:ConnectBoom,代码行数:101,代码来源:mod.weblog.php

示例5: COUNT

 /** -----------------------------------
     /**  Bulletin Board
     /** -----------------------------------*/
 function bulletin_board($message = '')
 {
     global $LANG, $DB, $OUT, $IN, $LOC, $SESS, $PREFS;
     $DB->query("UPDATE exp_members SET last_view_bulletins = '" . $LOC->now . "' WHERE member_id = '{$this->member_id}'");
     $this->title = $LANG->line('bulletin_board');
     $this->crumb = $LANG->line('bulletin_board');
     $this->conditionals['bulletins'] = 'n';
     $this->conditionals['no_bulletins'] = 'y';
     $this->conditionals['paginate'] = 'n';
     $this->conditionals['can_post_bulletin'] = $SESS->userdata['can_send_bulletins'] == 'y' ? 'y' : 'n';
     $this->single_parts['include']['message'] = $message;
     $this->conditionals['message'] = $message != '' ? 'y' : 'n';
     $this->single_parts['path']['send_bulletin'] = $this->_create_path('send_bulletin');
     /** ---------------------------------------
        	/**  Retrieve Bulletins
        	/** ---------------------------------------*/
     $dql = "SELECT m.screen_name, b.sender_id, b.bulletin_message, b.bulletin_date, b.bulletin_id ";
     $sql = "FROM exp_member_bulletin_board b, exp_members m\n\t\t\t\t WHERE b.sender_id = m.member_id\n\t\t\t\t AND b.bulletin_group = " . $DB->escape_str($SESS->userdata['group_id']) . "\n\t\t\t\t AND bulletin_date < " . $LOC->now . "\n\t\t\t\t AND \n\t\t\t\t (\n\t\t\t\t \tb.bulletin_expires > " . $LOC->now . "\n\t\t\t\t \tOR\n\t\t\t\t \tb.bulletin_expires = 0\n\t\t\t\t )\n\t\t\t\t ORDER BY b.bulletin_date DESC";
     /** ----------------------------------------
         /**  Run "count" query for pagination
         /** ----------------------------------------*/
     $query = $DB->query("SELECT COUNT(b.bulletin_id) AS count " . $sql);
     /** ----------------------------------------
         /**  If No Messages, we say so.
         /** ----------------------------------------*/
     if ($query->row['count'] == 0) {
         $this->single_parts['include']['bulletins'] = $LANG->line('message_no_bulletins');
         $this->return_data = $this->_process_template($this->retrieve_template('bulletin_board'));
         return;
     }
     /** ----------------------------------------
         /**  Determine Current Page
         /** ----------------------------------------*/
     $row_count = 0;
     // How many rows shown this far (i.e. offset)
     if ($this->allegiance == 'user') {
         $row_count = $this->cur_id;
     } else {
         $row_count = $IN->GBL('page', 'GP') === false ? 0 : $IN->GBL('page', 'GP');
     }
     if (!is_numeric($row_count)) {
         $row_count = 0;
     }
     $this->per_page = 5;
     $current_page = $row_count / $this->per_page + 1;
     $total_pages = intval($query->row['count'] / $this->per_page);
     if ($query->row['count'] % $this->per_page) {
         $total_pages++;
     }
     $this->single_parts['include']['page_count'] = $current_page . ' ' . $LANG->line('of') . ' ' . $total_pages;
     /** -----------------------------
        	/**  Do we need pagination?
        	/** -----------------------------*/
     $pager = '';
     if ($query->row['count'] > $this->per_page) {
         if (!class_exists('Paginate')) {
             require PATH_CORE . 'core.paginate' . EXT;
         }
         $PGR = new Paginate();
         if ($this->allegiance == 'user') {
             $PGR->path = $this->base_url . 'bulletin_board/';
         } else {
             $PGR->base_url = $this->base_url . 'bulletin_board';
             $PGR->qstr_var = 'page';
         }
         $PGR->total_count = $query->row['count'];
         $PGR->per_page = $this->per_page;
         $PGR->cur_page = $row_count;
         $this->single_parts['include']['pagination_link'] = $PGR->show_links();
         $this->conditionals['paginate'] = 'y';
         $sql .= " LIMIT " . $row_count . ", " . $this->per_page;
     }
     /** ----------------------------------------
         /**  Create Bulletins
         /** ----------------------------------------*/
     $this->conditionals['bulletins'] = 'y';
     $this->conditionals['no_bulletins'] = 'n';
     $folder_rows_template = $this->retrieve_template('bulletin');
     $i = 0;
     $r = '';
     $censor = FALSE;
     if ($PREFS->ini('enable_censoring') == 'y' && $PREFS->ini('censored_words') != '') {
         $censor = TRUE;
         if (!class_exists('Typography')) {
             require PATH_CORE . 'core.typography' . EXT;
         }
         $TYPE = new Typography(0);
     }
     $query = $DB->query($dql . $sql);
     if ($query->row['bulletin_date'] != $SESS->userdata['last_bulletin_date']) {
         $DB->query($DB->update_string('exp_members', array('last_bulletin_date' => $query->row['bulletin_date']), "group_id = '" . $DB->escape_str($SESS->userdata['group_id']) . "'"));
     }
     foreach ($query->result as $row) {
         ++$i;
         $data = $row;
         $this->conditionals['can_delete_bulletin'] = ($SESS->userdata['group_id'] == 1 or $row['sender_id'] == $SESS->userdata['member_id']) ? 'y' : 'n';
         if ($this->allegiance == 'cp') {
//.........这里部分代码省略.........
开发者ID:jlleblanc,项目名称:ConnectBoom,代码行数:101,代码来源:core.messages.php

示例6: entries


//.........这里部分代码省略.........
             $PGR = new Paginate();
             $deft_tmpl = '';
             if ($uristr == '') {
                 if (USER_BLOG !== FALSE) {
                     $query = $DB->query("SELECT group_name FROM exp_template_groups WHERE group_id = '" . $DB->escape_str(UB_TMP_GRP) . "'");
                     $deft_tmpl = $query->row['group_name'] . '/index/';
                 } else {
                     if ($PREFS->ini('template_group') == '') {
                         $query = $DB->query("SELECT group_name FROM exp_template_groups WHERE is_site_default = 'y' AND is_user_blog = 'n'");
                         $deft_tmpl = $query->row['group_name'] . '/index/';
                     } else {
                         $deft_tmpl = $PREFS->ini('template_group') . '/';
                         $deft_tmpl .= $PREFS->ini('template') == '' ? 'index' : $PREFS->ini('template');
                         $deft_tmpl .= '/';
                     }
                 }
             }
             $basepath = $FNS->remove_double_slashes($FNS->create_url($uristr, 1, 0) . '/' . $deft_tmpl);
             $first_url = substr($basepath, -5) == '.php/' ? substr($basepath, 0, -1) : $basepath;
             if ($TMPL->fetch_param('paginate_base')) {
                 $pbase = $REGX->trim_slashes($TMPL->fetch_param('paginate_base'));
                 $pbase = str_replace("&#47;index", "/", $pbase);
                 if (!strstr($basepath, $pbase)) {
                     $basepath = $FNS->remove_double_slashes($basepath . '/' . $pbase . '/');
                 }
             }
             $PGR->first_url = $first_url;
             $PGR->path = $basepath;
             $PGR->prefix = !$dynamic ? 'N' : 'P';
             $PGR->total_count = $total_rows;
             $PGR->per_page = $limit;
             $PGR->cur_page = $current_page;
             $PGR->suffix = $anchor;
             $pagination_links = $PGR->show_links();
             if ($total_pages * $limit - $limit > $current_page) {
                 $page_next = $basepath . 'P' . ($current_page + $limit) . '/';
             }
             if ($current_page - $limit >= 0) {
                 $page_previous = $basepath . 'P' . ($current_page - $limit) . '/';
             }
         } else {
             $current_page = '';
         }
     }
     // When only non-dynamic comments are show, all results are valid as the
     // query is restricted with a LIMIT clause
     if ($dynamic or $show_trackbacks === TRUE) {
         if ($current_page == '') {
             $result_ids = array_slice($result_ids, 0, $limit);
         } else {
             $result_ids = array_slice($result_ids, $current_page, $limit);
         }
     }
     /** -----------------------------------
         /**  Fetch Comments if necessary
         /** -----------------------------------*/
     $results = $result_ids;
     $mfields = array();
     if ($comments_exist == TRUE) {
         $com = '';
         foreach ($result_ids as $val) {
             if (substr($val, 0, 1) == 'c') {
                 $com .= substr($val, 1) . ",";
             }
         }
         if ($com != '') {
开发者ID:jlleblanc,项目名称:ConnectBoom,代码行数:67,代码来源:mod.comment.php

示例7: array


//.........这里部分代码省略.........
        if ($rownum != '')
        	$rownum = substr($rownum, 1);

		$rownum = ($rownum == '' || ($perpage > 1 AND $rownum == 1)) ? 0 : $rownum;
		
		if ($rownum > $total_rows)
		{
			$rownum = 0;
		}
					
		$t_current_page = floor(($rownum / $perpage) + 1);
		$total_pages	= intval(floor($total_rows / $perpage));
		
		if ($total_rows % $perpage) 
			$total_pages++;
		
		if ($total_rows > $perpage)
		{
			if ( ! class_exists('Paginate'))
			{
				require PATH_CORE.'core.paginate'.EXT;
			}
			
			$PGR = new Paginate();
				
			$PGR->first_url 	= $pageurl;
			$PGR->path			= $pageurl;
			$PGR->prefix		= 'R';
			$PGR->total_count 	= $total_rows;
			$PGR->per_page		= $perpage;
			$PGR->cur_page		= $rownum;
			$PGR->qstr_var      = 'rownum';
			
			$page_links	= $PGR->show_links();
			
			$result_ids = array_slice($result_ids, $rownum, $perpage);
		}
		else
		{
			$result_ids = array_slice($result_ids, 0, $perpage);	
		}


        /** ---------------------------------
        /**  Fetch Weblog Titles
        /** ---------------------------------*/

		if ($blog_subscriptions	== TRUE)
		{
			$sql = "SELECT
					exp_weblog_titles.title, exp_weblog_titles.url_title, exp_weblog_titles.weblog_id, exp_weblog_titles.entry_id,
					exp_weblogs.comment_url, exp_weblogs.blog_url	
					FROM exp_weblog_titles
					LEFT JOIN exp_weblogs ON exp_weblog_titles.weblog_id = exp_weblogs.weblog_id 
					WHERE entry_id IN (";
		
			$idx = '';
		
			foreach ($result_ids as $key => $val)
			{			
				if (substr($key, strlen($key)-1) == 'b')
				{
					$idx .= $val.",";
				}
			}
		
开发者ID:jmelton,项目名称:eb,代码行数:66,代码来源:mod.member_subscriptions.php

示例8: pager

 /** -------------------------------------
     /**  Paginate 
     /** -------------------------------------*/
 function pager($base_url = '', $total_count = '', $per_page = '', $cur_page = '', $qstr_var = '')
 {
     global $LANG;
     // Instantiate the "paginate" class.
     if (!class_exists('Paginate')) {
         require PATH_CORE . 'core.paginate' . EXT;
     }
     $PGR = new Paginate();
     $PGR->base_url = $base_url;
     $PGR->total_count = $total_count;
     $PGR->per_page = $per_page;
     $PGR->cur_page = $cur_page;
     $PGR->qstr_var = $qstr_var;
     return $PGR->show_links();
 }
开发者ID:jlleblanc,项目名称:ConnectBoom,代码行数:18,代码来源:cp.display.php

示例9: memberlist


//.........这里部分代码省略.........
		{ 											
			if ( ! class_exists('Paginate'))
			{
				require PATH_CORE.'core.paginate'.EXT;
			}
			
			$PGR = new Paginate();
			
			$PGR->first_url 	= $this->_member_path('memberlist'.$search_path);
			$PGR->path			= $this->_member_path('memberlist'.$search_path.$path, '');
			$PGR->suffix		= ($first_letter != '') ? $first_letter.'/' : '';
			$PGR->total_count 	= $query->row['count'];
			$PGR->per_page		= $row_limit;
			$PGR->cur_page		= $row_count;
			$PRG->first_page	= $LANG->line('first');   
			$PRG->last_page		= $LANG->line('last');   
			
			if (preg_match("/".LD.'pagination_links'.RD."/", $template))
			{
				$PGR->first_div_o	= '<td><div class="paginate">';
				$PGR->first_div_c	= '</div></td>';
				$PGR->next_div_o	= '<td><div class="paginate">';
				$PGR->next_div_c	= '</div></td>';
				$PGR->prev_div_o	= '<td><div class="paginate">';
				$PGR->prev_div_c	= '</div></td>';
				$PGR->num_div_o		= '<td><div class="paginate">';
				$PGR->num_div_c		= '</div></td>';
				$PGR->cur_div_o		= '<td><div class="paginateCur">';
				$PGR->cur_div_c		= '</div></td>';
				$PGR->last_div_o	= '<td><div class="paginate">';
				$PGR->last_div_c	= '</div></td>';
			}
			
			$pager = $PGR->show_links();			
			 
			$sql .= " LIMIT ".$row_count.", ".$row_limit;			
		}
					
        /** ----------------------------------------
        /**  Run the full query and process result
        /** ----------------------------------------*/
        
		$query = $DB->query($f_sql.$sql);    
	
		$str = '';
		$i = 0;

		if ($query->num_rows > 0)
		{	
			foreach ($query->result as $row)
			{
				$temp = $memberlist_rows;
				
            	$style = ($i++ % 2) ? 'memberlistRowOne' : 'memberlistRowTwo';
				
				$temp = str_replace("{member_css}", $style, $temp);
				$temp = str_replace("{path:profile}", $this->_member_path($row['member_id']), $temp);					
				
				if ($row['url'] != '' AND substr($row['url'], 0, 4) != "http") 
				{ 
					$row['url'] = "http://".$row['url']; 
				} 
				
				$temp = $this->_var_swap($temp,
										array(
												'aim_console'	=> "onclick=\"window.open('".$this->_member_path('aim_console/'.$row['member_id'])."', '_blank', 'width=240,height=360,scrollbars=yes,resizable=yes,status=yes,screenx=5,screeny=5');\"",
开发者ID:jmelton,项目名称:eb,代码行数:67,代码来源:mod.member_memberlist.php


注:本文中的Paginate::show_links方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。