-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: #2397
Comments
You have added a |
ok this is the code
}` |
I apologize, but I do not understand what you are saying. |
$path Cannot afford to work |
Some part of the system is already creating an instance of the View class. The way you are calling it will always return a singleton, so you need to make sure to tell it not to return a sharedInstance but to create a new one:
This will return a new instance that uses that path so you can then do with what you will. This is how I created a template engine on top of the view layer in Myth:Forums. |
@lonnieezell, Look again. haojielyb's call yours are the same.
|
Services::renderer($path, null, false); |
What does it do in production that it doesn't do in development? The overloaded method still runs, right? Need more details... |
In the development environment app\common.php views do not overwrite views of the system |
This sounds like what I described above. And I'm not sure there's much to do about this, honestly. I've added a view() method similar to yours in my forum setup and the method gets called so I don't think I can call it a bug. You're better served overriding the renderer service itself, or saving that instance to a base controller, like I've done in the link I gave above. If you really want to continue with an overridden view() method, you might be able to grab an instance of the renderer, modify the path, and the inject that instance back into the services container. That sounds like more trouble than it's worth, though. |
@lonnieezell, Caused by problem fixed in PR #2381? |
I am using CI4 rc3
when I edit .env CI_ENVIRONMENT = development
the function view in App/Common.php always get default \CodeIgniter\View\View
$renderer = Services::renderer($path);
the $path I pass in not action
if CI_ENVIRONMENT = production it canwork well
I think It because the debugger tool
The text was updated successfully, but these errors were encountered: