So reading this -
https://twig.symfony.com/doc/2.x/functions/dump.html
It looks like the Twig loader is in -
/var/www/html/catalog/controller/event/theme.php
But I'm not sure if that DebugExtension is somewhere? Anyone install the Twig dump that can help?
Jim
https://www.carguygarage.com
Yahoo Store since 2006 moved to OpenCart on January 24, 2020
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Jim
https://www.carguygarage.com
Yahoo Store since 2006 moved to OpenCart on January 24, 2020
Code: Select all
Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'Unknown "dump" function in "__string_template__5b2a435a5d40c2041f16a317c7f3982355f9d27bc7bde73b3a0933f726f087a3" at line 26.' in /var/www/html/system/library/template/Twig/ExpressionParser.php:574 Stack trace: #0 /var/www/html/system/library/template/Twig/ExpressionParser.php(351): Twig_ExpressionParser->getFunctionNodeClass('dump', 26) #1 /var/www/html/system/library/template/Twig/ExpressionParser.php(144): Twig_ExpressionParser->getFunctionNode('dump', 26) #2 /var/www/html/system/library/template/Twig/ExpressionParser.php(84): Twig_ExpressionParser->parsePrimaryExpression() #3 /var/www/html/system/library/template/Twig/ExpressionParser.php(41): Twig_ExpressionParser->getPrimary() #4 /var/www/html/system/library/template/Twig/Parser.php(144): Twig_ExpressionParser->parseExpression() #5 /var/www/html/system/library/template/Twig/TokenParser/For.php(40): Twig_Parser->subparse(Array) #6 /var/www/html/system/library/template/Twig/Parser.php(187): Twig_TokenPar in /var/www/html/system/library/template/Twig/ExpressionParser.php on line 574
Jim
https://www.carguygarage.com
Yahoo Store since 2006 moved to OpenCart on January 24, 2020
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Yes, I know. So how did you get it to work?
Jim
https://www.carguygarage.com
Yahoo Store since 2006 moved to OpenCart on January 24, 2020
If I need to check what I send to twig, I dump those variables in my php error log from the controller.
Besides, I only use twig to display variables and use as little twig logic as possible, for the rest I say far away from it.
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Edit this file -
catalog/controller/event/theme.php
Code: Select all
$config = array('autoescape' => false);
Code: Select all
$config = array('autoescape' => false,'debug' => true,);
Code: Select all
$this->twig = new \Twig_Environment($loader, $config);]
Code: Select all
$this->twig->addExtension(new \Twig_Extension_Debug());
Reason: Added code tags.
Jim
https://www.carguygarage.com
Yahoo Store since 2006 moved to OpenCart on January 24, 2020
Tested with Twig version: 1.24.2 ... might work with later.
It is done in accordance to Twig official docs: https://twig.symfony.com/doc/1.x/functions/dump.html
It is very simple to enable it.
step 1:
Find file:
Code: Select all
\Twig\Environment.php
Or search Twig folder for class: Twig_Environment
Inside of method in Twig_Environment:
Code: Select all
public function __construct()
Code: Select all
$this->addExtension(new Twig_Extension_Debug());
Code: Select all
$this->staging = new Twig_Extension_Staging();
In same file as in step 1, in same method:
Code: Select all
public function __construct()
First key/value pair change to:
Code: Select all
'debug' => TWIG_DEBUG,
Find main OpenCart configure.php - one in root folder, not admin one.
And add:
Code: Select all
define('TWIG_DEBUG', true);
When you want debugging and dump() var available, set it to true, when you want it disabled, set it to false.
So, TWIG_DEBUG constant is, so you do not have to look for that deep hidden Twig class to enable / disable debug.
That file name does not exist out-of-the-box.Find main OpenCart configure.php - one in root folder, not admin one.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Users browsing this forum: No registered users and 73 guests