Yii2 Framework references bootstrap in the date plug-in Yii2-date-picker method

Source: Internet
Author: User
The example in this article describes the YII2 Framework reference bootstrap in the date plug-in Yii2-date-picker method. Share to everyone for your reference, as follows:

Recently in the Learning YII2 framework, the framework was found to be powerful and combined with many new technologies in the present.

Simply record how the Yii2-date-picker plugin is used:

First look at the related resources in GitHub: Https://github.com/2amigos/yii2-date-picker-widget

Second: Download this resource in your own project using the related methods in the link above, and the command is:

PHP Composer.phar require "2amigos/yii2-date-picker-widget" "*"

Finally, use the following code in the view file:

Use Dosamigos\datepicker\datepicker;

Two methods are available in the example:

Method 1. Use widget mode

<?= datepicker::widget ([  ' model ' = $model,  ' attribute ' = ' date ',  ' template ' = ' {addon}{ Input} ',    ' clientoptions ' = [      ' autoclose ' = ' = ',      ' format ' = ' dd-m-yyyy '    ]]; >

Method 2. ActiveForm Way

<?= $form->field ($model, ' Date ')->widget (  datepicker::classname (), [    //inline too, not bad    ' Inline ' = ' and true,    //modify template for custom rendering    ' template ' = ' {input} ',    ' clientoptions ' = > [      ' autoclose ' = true,      ' format ' = ' dd-m-yyyy '    ]]; >

It is hoped that this article is helpful to the PHP program design based on YII framework.

The above describes the YII2 framework reference bootstrap in the date plug-in Yii2-date-picker method, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.