Answer the question
In order to leave comments, you need to log in
How to insert tag in head by condition in category controller?
There is a variable in the category controller that is not available in the header controller, you need to insert a tag into the head tag with a certain value of this variable.
I tried to pass this variable from the category controller to $this->document, but it did not work out - in the header it = null
Answer the question
In order to leave comments, you need to log in
We need to make a series of improvements.
In the system/library/document.php file,
add handlers:
private $myTag = array();
public function addMyTag($var) {
$this->myTag[] = $var;
}
public function getMyTag() {
return $this->myTag;
}
$data['myTag'] = $this->document->getMyTag();
{% for tag in myTag %}
{{ 'любой ваш html код или переменная '~tag }}
{% endfor %}
$this->document->addMyTag($var);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question