Apart from the example in Krajee Kartik Extension website, can you help me with other examples of Kartik Markdown Editor Examples.
Thanks
Apart from the example in Krajee Kartik Extension website, can you help me with other examples of Kartik Markdown Editor Examples.
Thanks
What exactly are you missing in given examples?
And where exactly are you stuck? or what do you not understand?
Then we could help you specifically with your problem instead of guessing what you need.
Regards
The format buttons (Bold, Italics etc) are not performing their functions. also the way it displays.
7243
Controller
public function actionCreate()
{
$model = new Course();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->course_id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
model
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "course".
*
* @property string $course_id
* @property string $course_category_id
* @property string $course_code
* @property string $course_name
* @property string $course_num
* @property string $course_summary
* @property string $course_start_date
* @property string $course_format
* @property integer $course_format_no
* @property integer $show_grade
*/
class Course extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'course';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['course_category_id', 'course_format_no', 'show_grade'], 'integer'],
[['course_code', 'course_name', 'course_start_date', 'course_format'], 'required'],
[['course_summary'], 'string'],
[['course_start_date'], 'safe'],
[['course_code'], 'string', 'max' => 100],
[['course_name'], 'string', 'max' => 255],
[['course_num', 'course_format'], 'string', 'max' => 20],
[['course_code'], 'unique'],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'course_id' => 'Course ID',
'course_category_id' => 'Course Category ID',
'course_code' => 'Course Code',
'course_name' => 'Course Name',
'course_num' => 'Course Num',
'course_summary' => 'Course Summary',
'course_start_date' => 'Course Start Date',
'course_format' => 'Course Format',
'course_format_no' => 'Course Format No',
'show_grade' => 'Show Grade',
];
}
}
view
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\markdown\MarkdownEditor;
/* @var $this yii\web\View */
/* @var $model app\models\Course */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="course-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'course_category_id')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'course_code')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'course_name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'course_num')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'course_summary')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'course_start_date')->textInput() ?>
<?= $form->field($model, 'course_format')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'course_format_no')->textInput() ?>
<?= $form->field($model, 'show_grade')->textInput() ?>
<?= $form->field($model, 'course_summary')->widget(
MarkdownEditor::classname(),
['height' => 300, 'encodeLabels' => false]
)->label(false); ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
Hi,
Have you setup the module config correctly?
Like described here? http://demos.krajee.com/markdown
Also have you already checked with for example "firebug" if you receive any errors?
For example when you click on one of the not working buttons?
If yes, what error do you receive?
Regards