How to install DateTimePicker in Yii2 - yii2

I have creating form fields. Here, i want to add DateTimePicker.
I have referred in google about some date time picker. i got so many.
DateTimePicker jQuery plugin
Bootstrap DateTimePicker.
My question is which plugin is best among them. and
How can i install that plugin?
Download directory and place where?
Install via cmd.?

You need to install or update your composer.
If you are using Ubuntu or Linux Operating System, open command prompt and run this command:
composer require --prefer-dist yiisoft/yii2-jui
This will create the jui folder which contains all the required plugins such as datepicker or any other you want to use in your website.
Now you just have to place this code in your form.php in views folder
use yii\jui\DatePicker;
<?= $form->field($model, 'from_date')->widget(\yii\jui\DatePicker::classname(), [
//'language' => 'ru',
'dateFormat' => 'MM-dd-yyyy',
]) ?>

You don't need to use jquery plugin for that. Yii2 has several widgets which you can use: Some of them are:
1) Yii2 Jui DatePicker
2) Kartik yii2-widget-datepicker
3) 2amigos yii2-date-picker-widget
You can use anyone of these.

Related

PhpStorm: set a specific library version as a project library

I am trying to make JQuery 1.8.3 and JQuery UI 1.9.2 project libraries in PhpStorm 2017. When I go to Settings >> Languages & Frameworks >> Javascript >> Libraries, there is a dropdown near the top with two options:
TypeScript community stubs: here I find simple listings for jquery and jqueryui with no version information.
Official Libraries: here I find listings for jQuery 2.0.0 and jQuery UI 1.10.2
What's the recommended way to get IDE support for the specific versions of these libraries that I intend to use on my project?
Update
I have downloaded the uncompressed jQuery 1.8.3 file and saved it on disk. Then from Settings >> Languages & Frameworks >> JavaScript >> Libraries I selected Add... to link to that custom file and the jQuery documentation.
With #LazyOne's help, I was even able to download what are hopefully the right docs from api.jquery.com. However, the results are mixed:
From good...
To poor...
To non-existent...
To errors...
I'm having the same results and this looks like a bug. I've tried the same project in 2016.3.3 and it showed me correct documentation while in 2017.2.3 IDE displays 2 identical links that do not work. You might want to report this at http://youtrack.jetbrains.com/issues/WEB#newissue=yes. This is also looks like a https://youtrack.jetbrains.com/issue/IDEA-77527 regression

Custom FormHelper templatees

The CakePHP docs on using the FormHelper suggest I should be able to create new templates for its output once, and use this throughout my project.
As described it requires modifying the loading of the FormHelper, from this:
$this->loadHelper('Form');
to this:
$this->loadHelper('Form', [
'templates' => 'app_form',
]);
where app_form refers to a file in the config directory. However, I haven't had to actually load the FormHelper at all, it's magically available already, and if I try to do the above I get an error to the effect the helper has already been loaded:
The "Form" alias has already been loaded with the following config: array (...
Don't know if the docs are out of sync with the current version of CakePHP, but I can't see how to use this functionality - anyone know?

How to install plugins conditionally based on platform using gulp?

I want to install a plugin only for android and not for ios platform. I want to do it using gulp, so I have created a gulp task for it and used platformify().filter(["android"]). Following is my code snippet but it doesn't work for me.Plugin gets added to both platforms. Not sure I have implemented it right. So any help will be appreciated.
gulp.task('InstallImageResizerPlugin',function(){
platformify().filter(["android"],sh.exec('cordova plugin add https://github.com/wymsee/cordova-imageResizer', {async: true}, function(code, output){}));

Using Alloy widget in Appcelerator project

I just found a website from where I can get alloy widgets http://alloylove.com/
Please tell me how to use/integrate downloaded widgets in my project.
You can use http://gitt.io/ instead of http://alloylove.com/ , because gitt.io can install widgets modules for you .
For example :- to install nl.fokkezb.loading widget http://gitt.io/component/nl.fokkezb.loading from your project root run this command
$ gittio install nl.fokkezb.loading
It`s easy .
You need to download the contents and put it inside the widget folder. Once that is done, update the config.json file. Once done, call createWidget call and you are good to go.

Yii2 include file to project

Now I have one twitter api library (TwitterAPIExchange.php).
What I want to do is just to autoload it to project and make it available all model/controller.
Is it possible? Please help!!
Add in your composer.json in require block this line:
"J7mbo/twitter-api-php": "*"
And in console run composer update.
In your models or controllers add use TwitterAPIExchange; and TwitterAPIExchange will be avaible in class.
More doc in https://github.com/J7mbo/twitter-api-php/wiki