display action of the problem module:Copy the Code Code as follows: Public function executelist (){$this->questions = questionpeer::d oselect (New Criteria ());}
We will modify this action to pass a sfpropelpager to the template instead of passing an array. At the same time, we will sort the questions according to the number of interests:Copy the Code Code as follows: Public function executelist (){$pager = new Sfpropelpager (' Question ', 2);$c = ne
;
var $pager = $ ("#pager");
Clear the contents of the page div
$ ("#pager span"). Remove ();
$ ("#pager a"). Remove ();
Add first page
if (Intpageindex = 1)
$pager. Append ("else {
var first = $ ("Pageclick ($ (this). attr (' a '), total, spaninterval);
return fals
{get; set;}}
Show Page
The code is as follows
Copy Code
JS Code
The code is as follows
Copy Code
$ (function () {$.post ("Getdata.ashx", NULL, function (data) {var total = data;Pageclick (1, Total, 3);});Pageclick = function (PageIndex, total, spaninterval) {$.ajax ({URL: "Getdata.ashx",Data: {"PageIndex": PageIndex},Type: "Post",DataType: "JSON",Success:function (data) {Index starting from 1Convert current pa
The following is a paging example program, which may seem complicated, but you only need to use it to find that everything is so simple: example. php (as the mainstream development language) lt ;? Php (as the mainstream development language, but you only need to use it to find that "everything is so simple ":)
Example. php (as the mainstream development language)
$ Conn = maid ("test", "123456", "test123 ");
Include_once "pager. inc. php (as the mai
plug-ins. To develop a lightweight paging plug-in, let's start with the most basic requirements of the plug-in. What is the most basic requirement of the paging plug-in? It is nothing more than page display and page switch between pages, therefore, our plug-ins need to focus on this basic requirement, rather than considering other possible requirements for the moment.
Determine the html and css plug-ins
After determining the requirements of the plug-in, the second step is the plug-in UI, that i
;questions = questionpeer::d oselect (New Criteria ());
}
We will modify this action to pass a sfpropelpager to the template instead of passing an array. At the same time, we will sort the problem according to the quantity of interest:
Copy Code code as follows:
Public Function Executelist ()
{
$pager = new Sfpropelpager (' Question ', 2);
$c = new Criteria ();
$c->adddescendingorderbycolumn (questionpeer::interested_users
set to/to indicate statement end Edit command with $EDITOR. \e. --Edit the previous SQL statement of the buffer to the file, the default call VI, the file will be placed in the/tmp path under ego (\g) Send command to MySQL server, Display result vertically. --control results are displayed as vertical display exit (\q) exit MySQL. Same as quit. --Exit Mysqlgo (\g) Send command to MySQL server. --
Displaying a large amount of data on a page is a common practice in Web projects, but is limited to the size of the screen, and in order to make it easier for users to read, we often need to display the data in pagination, so paging is an essential part of the project. PEAR::P Ager is a powerful paging class that is very convenient to use.
System requirements: php4.3.*/php5,pear::P ager
PEAR::P ager have two kinds of paging display mode, one is jumping, the other is sliding. What's the differe
adds one} Else {$ Page_count = $ amount/$ page_size; // if there is no remainder, the number of pages equals the total data volume divided by the result of each page}}Else {$ Page_count = 0;}
// Flip link$ Page_string = '';If ($ page = 1 ){$ Page_string. = 'Page 1 | previous page | ';}Else {$ Page_string. = '}If ($ page = $ page_count) | ($ page_count = 0 )){$ Page_string. = 'next page | last page ';}Else {$ Page_string. = '}// Obtain data and return results in two-dimensional array formatIf ($
-in is what, nothing more than the page number display, the switch between the page number, so, our plug-in should be around the basic needs to start, and temporarily do not consider other possible needs.Determine plugin HTML and CSSAfter determining the needs of the plug-in, the second step is the UI of the plugin, HTML and CSS.Suppose the basic UI is as follows:Basic Page-Paging UISee the basic UI above, do not know what kind of HTML structure you will think of. For our developers, HTML and CS
Implementation mode
There are many ways to achieve this by summarizing some of the most common ways, and then adding others later.
Viewpager + Radiogroup
Viewpager + fragmenttabhost
Viewpager +tablayout
Viewpager+radiogroup
Feel this is the simplest one, I do not put code to say that I understand the idea of it
By adding pager and radiogroup to monitor, monitor two control changes to achieve linkage
When the Viewpager display
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.