How does one enable automatic page feed for posts in web development? And how to display the content in only one region

Source: Internet
Author: User
How does web development enable automatic page feed for posts? In addition, how does one enable content to be displayed only in one region? How does web development enable automatic page feed for posts? For example, when you set 10 posts and 11th posts, the switch page is like oschina. This is almost the same type. how can this problem be achieved? I don't know what I just learned. please give me some advice. You can also recommend some materials. Thank you. In addition, how can we design a rectangular area so that the post will be displayed in this area after it is published? do not go beyond this area, just like how to implement automatic page feed for posts in OS web development? And how to display the content in only one region
How does web development enable automatic page feed for posts? For example, if you set 10 posts and 11th posts, you can switch pages.

Like oschina. This is almost the same type. how can this problem be achieved? I don't know what I just learned. please give me some advice. You can also recommend some materials. Thank you.



There is also a way to design a rectangular area so that the post will be displayed in this area after it is published. do not go beyond this area.

Like oschina.

Share: More


------ Solution --------------------



$ Curpage = isset ($ _ GET ['curpage'])? $ _ GET ['curpage']: 1;
$ Total = 1000;
$ Pagesize = 20;
$ Url = 'Page. php ';
$ Show = 10;

Echo page ($ curpage, $ pagesize, $ total, $ url, $ show );

Function page ($ curpage, $ pagesize, $ total, $ url, $ show ){

If ($ total <= 0
------ Solution --------------------
$ Curpage <= 0
------ Solution --------------------
$ Pagesize <= 0
------ Solution --------------------
$ Show <= 0 ){
Return '';
}

$ Pagecount = (int) ($ total-1)/$ pagesize) + 1;

If ($ curpage> $ pagecount ){
$ Curpage = $ pagecount;
}

$ Tmp = '';
$ Step = (int) ($ show/2 );

If ($ curpage-$ step <= 0 ){
$ Start = 1;
$ End = $ pagecount> $ show? $ Show: $ pagecount;
} Elseif ($ curpage + $ step >=$ pagecount ){
$ Start = $ pagecount-$ show + 1;
$ End = $ pagecount;
} Else {
$ Start = $ curpage-$ step;
$ End = $ start + $ show-1;
}

If ($ curpage> 1 ){
$ Tmp. = 'previous page ';
}

For ($ I = $ start; $ I <= $ end; $ I ++ ){
If ($ I ==$ curpage ){
$ Tmp. = ''. $ I .'';
} Else {
$ Tmp. = ''. $ I .'';
}
}

If ($ curpage <$ pagecount ){
$ Tmp. = 'next page ';
}

$ Tmp. = 'Total: '. $ total.', total '. $ pagecount.' page ';

Return $ tmp;
}
?>

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.