Replacing Core Classes in Codeigniter 4? - codeigniter-4

i want to create new function in core class CI4, i found this topic here https://codeigniter.com/user_guide/extending/core_classes.html
but i got this error in the image. in the codeigniter 3, its easy do it with "MY_" prefix, but CI4 i dont know how to do it.

You can't use echo and return view together

Related

Include Does Not Work In Codeigniter 4.1.9

Hye, I'm still trying to dive in to learn some of the framework such as Codeigniter and Laravel, but i stumbled into a problem which is $this->include does not work, I am trying to include file that have html code... I've tried looking on the internet, trying out several other method but it still does not work
Here What I've Been Trying,
$this->include('test');
I've Also Tried Using The Controller Code Which Is,
return view('test');
And Lastly, I've tried,
$this->load->view('test');
But none of them works.
Try echo view('test');
Loading Multiple Views
echo view_cell('view file',[$datas=>$values])
https://codeigniter.com/user_guide/general/common_functions.html?highlight=view_cell#view_cell

B2B hybris module gen does not work

AFter using b2b_acc recipe, i want to do module gen. like:
ant modulegen -Dinput.module=accelerator -Dinput.name=qqq -Dinput.package=com.fffff.sampa -Dinput.template=develop
but it gives error of
hybris "java.util.regex.PatternSyntaxException": Illegal repetition near index 0 ${YMODULE_TOKEN}(.*)
And there is no information about how to do for b2b.
What can i do? I need to develop a b2b website. Should i use extgen?
Now it gives this:
java.lang.IllegalArgumentException: cannot merge namespace
((fulfilmentprocess)) into (()) due to duplicate attribute
'ConsignmentProcess.done(java.lang.Boolean):((fulfilmentprocess))::YAttributeDescriptor[fulfilmentprocess-items.xml:18(AttributeTagListener)][PROPERTY]'
vs
'ConsignmentProcess.done(java.lang.Boolean):((yacceleratorfulfilmentprocess))::YAttributeDescriptor[yacceleratorfulfilmentprocess-items.xml:18(AttributeTagListener)][PROPERTY]'
When you are creating your custom extension using modulegen, you should delete existing template extension as well in your localextension.properties file.
Remove any of the following extensions that might appear in your localextensions.xml file
yacceleratorcore
yacceleratorfacades
yacceleratorstorefront
yacceleratorinitialdata
yacceleratortest
yacceleratorcockpits
yacceleratorfulfilmentproces
Read Here for more details on how to customize Accelerator using modulegen :
https://help.hybris.com/6.6.0/hcd/8ace75c786691014a5e9dcafa29d5410.html
Removing yacceleratorbackoffice work for me.
This issue is version-dependent but try removing yacceleratorfulfilmentproces or yacceleratorbackoffice from localextensions.xml and that may help.

Change phpbb3.1 style to twig syntax

Recording to this, version 3.1 of phpBB should parse their old syntax to twig style now. I would like to use the parsed twig files to create a new style. I guess they can be found in the cache folder, but thats not very comfortable to reuse.
So Iam looking for the method that parses the old style to the knew one and to use it on the original files. I couldn't find it yet by just crawling through the sourcecode.
I found it myself. Its in the phpBB3/phpbb/template/twig/lexer.php file.
To use the class standalone, just remove
extends \Twig_Lexer
and replace
return parent::tokenize($code, $filename);
by
return $code;
Then you can run
$lexer = new lexer();
echo $lexer->tokenize($originalTemplateCode);
//returns template-code in twig-style syntax
Of course, thats a dirty hacked solution, but as long you only need it once to change the basic style for using it, its ok to do so

Reorganize directory structure MVC ExtJs 4 App

I have learned from the sencha doc how to create a simple MVC application, and now I wonder if it is possible to move from this structure :
-app
--Controller
---controller1.js
---controller2.js
...
--Model
---model1.js
---model2.js
...
--Store
---store1.js
---store2.js
...
--View
---view1.js
---view2.js
...
to this modular structure :
-app
--Module1
---controller.js
---model.js
---store.js
---view.js
--Module2
---controller.js
---model.js
---store.js
---view.js
I want also if you can advise me about the modular structure (good, bad, complex, remarks...), Thank you in advance.
You can do whatever you want with different file and class names. Just remember to keep class name in sync with its position in the file hierarchy. For example if you have class
MyApp.controller.Controller1
located in the following file
- app\Controller\Controller1.js
If you move it to the
- app\module1\Controller.js
You would need to rename class name to
MyApp.module1.Controller
See for yourself whether having such class hierarchy would be appropriate for you. I would not do this. We keep all code according to ExtJs MVC directory structure (mostly). We have the following directories
- store
-- base
- view
-- base
- controller
- model
We usually put base classes underneath special base director to easily separate them from the rest of code.

Case sensitivity in URL issue on Linux + NGinx + Kohana + php

There is an issue/bug/feature/whatever on Linux + NGinx + Kohana :
We have to make sure that we keep all our file names in lowercase only.
We can't have anything like "setUserServer.php". It simply doesn't work. No idea why.
If we give the name of the same file as "setuserserver.php", it runs.
This problem doesn't exist on Windows + Apache + Kohana.
If anyone has an idea how to solve this, please do chime in this thread.
Thanks.
Solution is sticking to the naming scheme of kohana: all files lower case
Windows by default is not case sensitive, and linux is. Can't "solve" that
You can use mixed case for a vendor libraries (loading by include or require), but original Kohana's autoloader will convert class names to lower case (as SpadXIII). So, possible solution is writing your own autoloader (or extend Kohana class) and use it instead/before standard.
PS. AFAIR, View class will work with files like PageTemplate.php

Resources