Welcome Guest, Not a member yet? Register   Sign In
add_package_path() equivalent?
#1

Hello, new to the forums.

The company I work for currently uses CodeIgniter 3.x. One of our projects is somewhat of a whitelabel with a shared code base.

We currently use add_package_path() to load views/helpers/configs/constants/etc. on a per whitelabel (site) basis. You get the picture.

We extend CI_Controller like so:

PHP Code:
class US_Controller extends CI_Controller {
    public function __construct()
    {
        parent::__construct();
        $this->load->add_package_pathAPPPATH "sites/" SITE_NAME);
    }





In this example, when loading a view, it first looks for the view in the 'sites/' path and loads the view if it exists there. If not found, it looks for the view in the normal views/ directory and loads that as the fallback (like a global/common view).

TLDR:
Is anything like this possible in CodeIgniter 4? I realize there are namespaces, but we're looking to just
Code:
echo view('viewFile')
 
as usual without specifying anyting extra/special every time. Is there a similar way to extend the CI loader? Anything? Just now starting to dive into CI4, so pardon my ignorance in advance Smile
Reply


Messages In This Thread
add_package_path() equivalent? - by Aric - 02-23-2020, 01:22 PM
RE: add_package_path() equivalent? - by MGatner - 03-01-2020, 08:41 AM
RE: add_package_path() equivalent? - by Aric - 12-18-2021, 02:27 PM
RE: add_package_path() equivalent? - by kenjis - 12-19-2021, 02:49 AM
RE: add_package_path() equivalent? - by Aric - 12-22-2021, 04:15 AM
RE: add_package_path() equivalent? - by kenjis - 12-22-2021, 05:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB