PHP code example of narekmarkosyan / yii2-html-cache
1. Go to this page and download the library: Download narekmarkosyan/yii2-html-cache 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/ */
Yii::$app->htmlcache->directReplace("DATE_PLACEHOLDER", date("Y-m-d H:i:s"));
// OR
Yii::$app->htmlcache->directReplace(array("DATE_PLACEHOLDER"=> date("Y-m-d H:i:s")));
Yii::$app->htmlcache->excludeActions($this, "my_action");
// OR
Yii::$app->htmlcache->excludeActions($this, array("my_action", "my_other_action"));
Yii::$app->htmlcache->allowActions($this, "my_action");
// OR
Yii::$app->htmlcache->allowActions($this, array("my_action", "my_other_action"));
// OR
Yii::$app->htmlcache->allowActions($this, null); // Removes all actions of this controller
Yii::$app->htmlcache->excludeParams($this, "my_action"); // Disable cache if $this->my_action != false
// OR
Yii::$app->htmlcache->excludeParams($this, array("my_action" => 1)); // Disable cache if $this->my_action == 1
// OR
Yii::$app->htmlcache->excludeParams($this, array("my_action" => array(1, 2))); // Disable cache if $this->my_action == 1 OR $this->my_action == 2
Yii::$app->htmlcache->allowParams($this, "my_action"); // Removes all mentions of my_action of this controller if exsists
// OR
Yii::$app->htmlcache->allowParams($this, array("my_action" => 1)); // Removes my_action == 1 mention from this controller if exsists
// OR
Yii::$app->htmlcache->allowParams($this, array("my_action" => array(1, 2))); // Removes my_action == 1 OR my_action == 1 mentions from this controller if exsists
// OR
Yii::$app->htmlcache->allowParams($this, null); // Removes ALL excluded params of this controller
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.