Welcome Guest, Not a member yet? Register   Sign In
Extending View?
#2

The way I've handled this is to create a new instance of the renderer service, giving it the path to my themes folder:

PHP Code:
$path ROOTPATH ."themes/{$this->theme}";
$renderer Services::renderer($pathnullfalse); 

Passing false as the last argument gives you a non-shared instance. Now, when you use things like $this->extend(), or $this->include() within your views, it will always find it within your theme directory. In the example I linked to, it supports multiple themes within the Themes directory.

If you need to get a view from the normal path anywhere, you can still use echo view('...'), which uses the main, shared, instance of the View library that points to the default location.
Reply


Messages In This Thread
Extending View? - by easyD - 05-06-2020, 09:50 AM
RE: Extending View? - by kilishan - 05-06-2020, 10:24 AM
RE: Extending View? - by easyD - 05-06-2020, 11:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB