Jump to content

[SOLVED] who can explain me this line of code ?


jemmeli

Recommended Posts

hello

 

when i was surfing one of free modules that i download it i found the following line of code in the module file but i did'nt understand what it does exectlly :

 

the line :

 

if(get_class($this->context->controller)=="IndexController")

 

thank you in advance for the help :

Edited by jemmeli (see edit history)
Link to comment
Share on other sites

prestashop is based on MVC (model - view - controller)

 

the code you pasted is related to the CONTROLLER

 

each controller is a PHP Class

 

What does it mean?

if(get_class($this->context->controller)=="IndexController")

this code means:

 

if $this->context->controller is "indexController" then do something.

 

 

what you want to achieve exactly?

  • Like 1
Link to comment
Share on other sites

thank you for the explanation :

 

plz I have another line of code i did'nt found any explanition on the net :

 

public function renderForm() {
	if (!($obj = $this->loadObject(true)))
		return;

 

i want to ask what is the role of the loadObject in the renderForm methode inside a controller ?

I did'nt found any expalnation about the loadObject in the prestashop 1.5 docs

 

and thank you in advance

Edited by jemmeli (see edit history)
Link to comment
Share on other sites

thank you for the explanation , i did not found like this informations in the docs of prestashop , for example the loadobject is not mentionned in the docs prestashop 1.5 , as many other objects in prestashop is not mentioned in docs !!!!

Edited by jemmeli (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...