Page 1 of 1

php to twig do not work

Posted: Sat Jan 26, 2019 3:56 am
by jonkers20
hello I am working on a module of 2.x which to 3.x.
But I can not get this php to twig properly

Code: Select all

<php array_unshift($stock_statuses, array('stock_status_id' => 0, 'name' => '' )); foreach ($stock_statuses as $stock_status) { ?>

Re: php to twig do not work

Posted: Sat Jan 26, 2019 11:31 pm
by straightlight
Partial code posted; complete solution needed. Forum rules.

Re: php to twig do not work

Posted: Sat Jan 26, 2019 11:40 pm
by JNeuhoff
Perhaps the Twig merge filter can accomplish the same thing.

Or you can keep it as a PHP template and use our Template Switcher PHP/Twig to also support PHP templates in OpenCart 3.

Re: php to twig do not work

Posted: Sat Mar 09, 2019 4:38 pm
by letxobnav
In my opinion you should keep data logic in the controller and display logic in the views.

Re: php to twig do not work

Posted: Sat Mar 09, 2019 11:34 pm
by straightlight
Also:

Code: Select all

<php
for:

Code: Select all

<?php