Skip to content

Instantly share code, notes, and snippets.

@khoand0000
Last active August 29, 2015 14:08
Show Gist options
  • Save khoand0000/fa4354ec8525f4a70699 to your computer and use it in GitHub Desktop.
Save khoand0000/fa4354ec8525f4a70699 to your computer and use it in GitHub Desktop.
yii
<?php
/* @var $this yii\web\View */
// convert to url
\yii\helpers\Url::to(['auto-save/save-data']);
// current user (logged)
Yii::$app->user->identity->id;
// output a tag
yii\helpers\Html::a('Manage Users', ['user/index'], ['class' => 'list-group-item']);
// load js file after jQuery
$this->registerJsFile('@web/js/auto-save.js', array(
'depends' => [yii\web\JqueryAsset::className()]
));
// load js code at head
$this->registerJs('var saveDataUrl="'.\yii\helpers\Url::to(['auto-save/save-data']).'";', $this::POS_HEAD);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment