New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to use in yii2-advanced #10
Comments
Hi, for example: $model = PostModel::findOne(['title' => 'some post title']);
$model = UserModel::find()->where(['email' => 'some email'])->one(); |
Can I use it in yii2 -advanced/frontend/views straightly? Thank you. |
I saw the second closed issues. May I have to use 'en-US' in my application if I want to use this. |
yes, of course. Code for example: // In your controller
$post = PostModel::findOne(['title' => 'your post title']);
return $this->render('your view', [
'post' => $post
]);
// In your view file
<?php echo \yii2mod\comments\widgets\Comment::widget([
'model' => $post,
'relatedTo' => 'User ' . \Yii::$app->user->identity->username . ' commented on the page ' . \yii\helpers\Url::current() // for example
]); ?>
Yes, of course. Yii2 by default used the 'en-US' language. |
What's the 'PostModel' ? |
This model just for example, you need to use your own models in your project. |
I don't know
<?php echo \yii2mod\comments\widgets\Comment::widget([ 'model' => $model, 'relatedTo' => 'User ' . \Yii::$app->user->identity->username . ' commented on the page ' . \yii\helpers\Url::current() // for example ]); ?>
about what is the '$model'. Is't a model =new user?The text was updated successfully, but these errors were encountered: