1. Go to this page and download the library: Download laker-ls/yii2-pencil library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
public $categoryId;
public function actionIndex($category)
{
// Где $category объект текущей категории.
$this->categoryId = $category->id;
// Если страница статическая, то можем задать `id` явно, но данный способ не является хорошей практикой.
$this->categoryId = 1;
return $this->render('view');
}
use lakerLS\pencil\widgets\PencilText;
<?= PencilText::widget(['id' => 'example-id'])
use lakerLS\pencil\widgets\PencilText;
<?= PencilText::widget(['id' => 'example-id', 'nonUnique' => 'this-name-layout'])