A
A
ademar262017-08-25 15:22:41
opencart
ademar26, 2017-08-25 15:22:41

Where is the load.php file?

Where is the load.php Opencart 2.0 controller file? By which $this->load->language $this->load->model $this->load->controller
is called And I also can’t understand how the data is selected using the
$this->language->get() method
$ this->config->get()
$this->request->get()

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Immortal_pony, 2017-08-25
@ademar26

The loader ($this->load) is described in the Loader class, located in /upload/system/engine/loader.php
$this->config - This is an instance of the Config class, into which data from the database is loaded (settings table).
$this->request - an instance of the Request class, located in /upload/system/library/request.php
Description of the Language class can also be found in the folder /upload/system/library/
More details about the config.
The config.php file in the "catalog" and "admin" folders is not directly related to the class instance of the Config class, which is available via $this->config in various parts of the system.
Initially, data is loaded into it from the file upload/system/config/default.php
Next, data from the application config is loaded into it. The default is upload/system/config/catalog.php , but you can override this in the "catalog/config.php" and "admin/config.php" files.
This logic is described in the file upload/system/framework.php .
Further (I don’t know exactly how), data from the settings table is also loaded into the config.

A
Anton, 2017-08-25
@sHinE

Since you are accessing through $this, it means that you are in a file of some class. If this class itself does not have such a property, then there are two options. First, your class is inherited from some other class. Look for this class - either in the same folder, or look at the beginning of the file for what you have written in use. Check classes up the inheritance chain - look for this property. If not found, then look for the __get() method of the class along the inheritance chain.
Class autoloading can also be configured - then you need to look for classes used in use, taking it into account.
Well, or put some IDE for php - it should show you where this property is set by ctrl+click on ->load.

M
Maxim Timofeev, 2017-08-25
@webinar

$this->load->language
it's not a chain of files, it's an object and a chain of its methods. And the load method seems to be in the same file where you got this piece of code from, since $thisthis is the current class. Perhaps the method is not in it, but in the class from which it is inherited.
To understand what and how, read about OOP.

S
surfernsk, 2018-02-22
@surfernsk

$this->load is defined in /system/library/config.php

public function load($filename) {
    		$file = DIR_CONFIG . $filename . '.php';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question