in arrayloader php line 44 unknown package has no name defined
twig ‘include’ does not work in Opencart 3.0.3.6 #8134
Comments
kopitoshka commented Jul 26, 2020
Twig has ‘include’ functions which worked well in the past versions. Since twig loader was changed to ArrayLoader from FileSystem Loader the twig ‘include’ functions stopped working.
Could you add support of twig include functions? Maybe it is worth to use ChainLoader instead of using just one of loaders above?
The text was updated successfully, but these errors were encountered:
We are unable to convert the task to an issue at this time. Please try again.
The issue was successfully created but we are unable to update the comment at this time.
Eco1973 commented Jul 28, 2020
I second that, getting: PHP Fatal error: Uncaught Error: Class ‘Twig\Loader\ArrayLoader’ not found
bluegeeks1988 commented Aug 9, 2020
I not sure if i am correct in this but inside folder: system/library/template/ the actual Twig folder is not there in 3.0.3.6? but its there in 3.0.3.5? has there been a change how it loads now?
luisvelazquez commented Aug 11, 2020
Do you know of an alternative solution instead of placing all code in the same file?
I was using << include('file.twig') >> to make it more readable.
MikhailShemelin commented Aug 12, 2020
Do you know of an alternative solution instead of placing all code in the same file?
I was using << include('file.twig') >> to make it more readable.
prabhatkumaroc082 commented Jan 9, 2021 •
mhcwebdesign commented Jan 14, 2021
As far as I know the core OC twig files don’t contain include-tags.
For extensions, rather than using an include-tag in twig, use a variable
in your main controller, and a separate controller for file, and
in your main twig file. This makes it more compliant with the MVC design.
MikhailShemelin commented Jan 14, 2021
As far as I know the core OC twig files don’t contain include-tags.
For extensions, rather than using an include-tag in twig, use a variable
in your main controller, and a separate controller for file, and
in your main twig file. This makes it more compliant with the MVC design.
Using twig include-tags is useful, because:
For example, many of the default opencart theme templates have code like this (so it is duplicated many times)
If you need to change the view of breadcrumbs on the website (and CSS functionality is not enough), you have to change every template file containing breadcrumbs (etc., all the issues code duplication caused are here).
To get rid of this code duplication using the twig include-tag it is enough to create a specific template file for rendering breadcrumbs and just include it in all the necessary templates, something like
Without using the twig-include tag is it necessary not only to created the breadcrumb twig template and to put a code like this to all mentined templates
but also add additional rendering code to all appropriate controllers
So it gives more code, more duplication and more complicity all together.
mhcwebdesign commented Jan 15, 2021 •
Twig in general, especially the version as implemented by the Symfony framework, was a poor fashion choice because PHP already is a better template language.
And if you are so desperate to implement one of those many poor frontend web themes with excessive twig features, you can always enable the include-feature by using Symfony’s Twig chain loader, e.g. something like this in the system/template/twig.php:
MikhailShemelin commented Jan 15, 2021 •
Twig in general, especially the version as implemented by the Symfony framework, was a poor fashion choice because PHP already is a better template language.
May be. But twig (like many other template engines) still helps to force less qualified developers to use templates as templates only (it is not convenient to code application logic in twig and normally it does not allow or at least makes difficult to load controllers/models/libraries/etc. in templates). So it’s worth it.
And if you are so desperate to implement one of those many poor frontend web themes with excessive twig features
, you can always enable the include-feature by using Symfony’s Twig chain loader, e.g. something like this in the system/template/twig.php:
Yes, and it is the way I think it should be impelented in opencart by default (in its stock version).
Otherwise every second developer will implement it by his own (as a kind of modification), then different implementations will met each other on opencart websites using extensions/themes created by different developers and it will cause conflicts (bad experience for users, additional work for developers).
PostgreSQL errors on symfony server launch
in the console I am getting thoses errors :
After this the Symfony’s default page is loading correctly but when I add a route to the url for example : https://127.0.0.1:8000/testtt I’m getting this error :
2 Answers 2
This question pops up often enough that I think an answer is appropriate until the issue is resolved.
Assume you just created a new Symfony website-skeleton app, added a new controller and started the development server. You navigate to your new route and exceptions are tossed. Either get a ‘driver not found’ or a ‘could connect to server’. Which of course is a bit unexpected since you have not yet done anything with the database.
The problem is that the Doctrine migrations bundle provides a data collector for Symfony’s profiler bar that shows up at the bottom of the browser page when running in development mode. The data collector needs to connect to the database in order to collect migrations data. It does not care about the fact that there is no database. It just tries to connect and ends up tossing an exception.
I opened an issue on this. I am still not entirely sure if this is a feature or bug. Feel free to comment on the issue if you like.
This is a fairly recent problem though I have not tracked exactly when it first popped up. Hence many existing tutorials and step by step guides do not mention it. Consider it to be part of your development experience. Learning how to read exceptions is quite important.
There are several solutions. If you plan on using a database then go ahead and create yourself a database and adjust the DATABASE_URL to point to it. The database can be empty. The migration data collector just needs to be able to connect to it. On my local development machine I actually created a database called db_name just to avoid this error message.
A second solution is to just remove the migrations bundle with
And the problem goes away. If later on you need migrations then just use composer require to re-install it.
Проблема с компиляцией скриптов в модах
Мне бы не помешала помощь. Проблема такая. Решил собрать в кучку моды, делающие игру приближенной к версии, показанной на e3. Скачал, установил, естественно повылезала куча ошибок компиляции скриптов. Script merger’ом удалось исправить большую часть ошибок, но вылезли вот эти две. Если кто-то сможет помочь, буду безмерно благодарен, рад и счастлив 🙂
Открыл оба, в каждом нашёл проблемные строки из ошибки (52 и 68). Не знаю, что мне это даёт, но вдруг это важно для решения проблемы
Assassins11148
Попробуй перед enum EAreaName поставить /* чтобы получилось:
enum EDlcAreaName
<
AN_Dlc_Bob = 11,
>
*/
(То бишь в конце не забыть закрыть скобку */ )
Так ты исключишь этот повторяющийся скрипт (о чем и говорит нам ошибка)
Однако, после перекомпиляции могут появиться и другие скрытые ошибки
fatal error Uncaught Twig\Error\LoaderError: Template
I am new to opencart and I have installed Opencart 3 and I am trying to install the following theme:
I have read several posts and watched many videos and followed the steps correctly. After following the steps i get a message «The theme is successfully installed». But when I go to the themes section in my dashboard in opencart 3 and select the newcrocus theme it gives me the following error on the homepage:
Fatal error: Uncaught Twig\Error\LoaderError: Template «newcrocus/template/new_elements/product.twig» is not defined in «newcrocus/template/extension/module/featured.twig» at line 51. in C:\xampp\htdocs\azaan-leather\system\storage\vendor\twig\twig\src\Loader\ArrayLoader.php:70 Stack trace: #0 C:\xampp\htdocs\azaan-leather\system\storage\vendor\twig\twig\src\Environment.php(299): Twig\Loader\ArrayLoader->getCacheKey(‘newcrocus/templ. ‘) #1 C:\xampp\htdocs\azaan-leather\system\storage\vendor\twig\twig\src\Environment.php(381): Twig\Environment->getTemplateClass(‘newcrocus/templ. ‘) #2 C:\xampp\htdocs\azaan-leather\system\storage\vendor\twig\twig\src\Template.php(333): Twig\Environment->loadTemplate(‘newcrocus/templ. ‘, NULL) #3 C:\xampp\htdocs\azaan-leather\system\storage\cache\template\8e\8e5c9e03d41b9c67dbbfdfd20808223d84672524fec4b240d8d454a0e60d71ab.php(281): Twig\Template->loadTemplate(‘newcrocus/templ. ‘, ‘newcrocus/templ. ‘, 51) #4 C:\xampp\htdocs\azaan-leather\system\storage\vendor\twig\twig\src\Template.php(4 in C:\xampp\htdocs\azaan-leather\system\storage\vendor\twig\twig\src\Loader\ArrayLoader.php on line 70.
Please help me with the mentioned issue. I don’t know if the problem is in the template files or in the vendor folder.
localIdentName option moved in css-loader configuration #2197
Comments
jfly commented Jul 29, 2019 •
BREAKING CHANGES
When we upgrade to css-loader >= 3.0, we see the following crashes when compiling:
I think the relevant webpacker source code is here
The text was updated successfully, but these errors were encountered:
We are unable to convert the task to an issue at this time. Please try again.
The issue was successfully created but we are unable to update the comment at this time.
jakeNiemiec commented Jul 29, 2019
Webpacker only supports css-loader versions greater than 2.1.1, and less than 3.0.0.
gyurcigyurma commented Aug 1, 2019 •
I faced same issue after upading css-loader but I solved it.
If you check css-loader readme, then I noticed that «localIdentName» moved into modules key (it is possible that isn’t a recent change, just my artifacts were old).
My current working config is:
Old wrong config was:
Maybe you can check it also.
davidlbean commented Aug 5, 2019
For anyone not a webpack guru (and I’m not!), I found the code @gyurcigyurma ‘s code suggestion in my Rails app under /node_modules/@rails/webpacker/package/utils/get_style_rule.js.
jfly commented Aug 13, 2019
Webpacker only supports css-loader versions greater than 2.1.1, and less than 3.0.0.