jemmeli Posted June 18, 2013 Share Posted June 18, 2013 (edited) 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 July 30, 2013 by jemmeli (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted June 18, 2013 Share Posted June 18, 2013 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? 1 Link to comment Share on other sites More sharing options...
jemmeli Posted June 18, 2013 Author Share Posted June 18, 2013 (edited) 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 June 18, 2013 by jemmeli (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted June 18, 2013 Share Posted June 18, 2013 loadObject function loads object specification that you've got defined in the object definition, then displays form with fields based on object definition Link to comment Share on other sites More sharing options...
jemmeli Posted June 19, 2013 Author Share Posted June 19, 2013 as I understand the $definition object definied in the model by: public static $definition = array( //some code ); will be loaded in the controller by the loadobject method Link to comment Share on other sites More sharing options...
vekia Posted June 19, 2013 Share Posted June 19, 2013 that's right 1 Link to comment Share on other sites More sharing options...
jemmeli Posted June 19, 2013 Author Share Posted June 19, 2013 (edited) 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 June 20, 2013 by jemmeli (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now