Answer the question
In order to leave comments, you need to log in
How to convert PHP code to TWIG?
Greetings, there is a code to check for a user agent to hide the metric from page-speed, it does not work on opencart 3, because there is a TWIG code, I tried it through the PHP to TWIG conventions - the site crashes, can anyone help with this issue? Code below.
<?php if (!isset($_SERVER['HTTP_USER_AGENT']) || stripos($_SERVER['HTTP_USER_AGENT'], 'Lighthouse') === false): ?>
<?php endif; ?>
Answer the question
In order to leave comments, you need to log in
in controller
if (!isset($_SERVER['HTTP_USER_AGENT']) || stripos($_SERVER['HTTP_USER_AGENT'], 'Lighthouse') === false)
{
$data['check']=true;
}
else
{
$data['check']=false;
}
{% if check == true %}
скрипты
{% endif %}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question