Yii2 page extension to jump to a specific page, yii2 page extension jump _ PHP Tutorial

Source: Internet
Author: User
Yii2 page extension redirects to a specific page, yii2 page extension jump. Yii2 page extension to jump to a specific page, yii2 page extension jump author: White Wolf Source: www.manks.topyii2_linkpager_widget.html this article copyright to the author, you are welcome to reprint, yii2 page extension implementation jump to a specific page, yii2 page extension jump

Author: White Wolf Source: http://www.manks.top/yii2_linkpager_widget.html this article copyright to the author, welcome to reprint, but without the author's consent must retain this paragraph of the statement, and in the article page clearly given the original connection, otherwise, you are entitled to pursue legal liability.

First look at the effect. although the style is a bit ugly, it doesn't matter. I believe that you pay more attention to how this function is implemented when you get the code!

(See the original image)

It is not hard to see that the function for redirecting to a page is based on the extension above linkpager. The paging extension we previously implemented is obviously different, and the previous one is obviously rewritten! Of course, this is not important. let's take a look at the specific implementation of GoLinkPager! The name is a bit lower, not important!
1. create a GoLinkPager class file in the frontend \ components directory.

2. this class inherits yii \ widgets \ LinkPager;, as follows:

namespace frontend\components; use yii\widgets\LinkPager; use yii\helpers\Html; class GoLinkPager extends LinkPager { }

3. Add public $ go = false; // whether to include the jump function. the default value is false.

4. rewrite the renderPageButtons method of the parent linkPager class. for details, refer to the full code below. you can refer to the code implementation in the go section.

[Considering that most of the articles collected on Chinese websites are very frequent at present, the author does not specify the source of the original article. the original author prefers the readers to check the original article to avoid updating all the articles due to any problems and avoid misleading.]

Continue reading

Author: White Wolf Source: http://www.manks.top/yii2_linkpager_widget.html文, welcome to reprint ,...

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.