sarfaraz.r1406 Posted April 1, 2014 Share Posted April 1, 2014 How can I define my own variables for a module. Because when I am trying to define my variables for a module in hookLeftColumn function it is giving me an error. Link to comment Share on other sites More sharing options...
vekia Posted April 1, 2014 Share Posted April 1, 2014 what error you've got and how you tried to define these variables? can you show a part of code, please? Link to comment Share on other sites More sharing options...
sarfaraz.r1406 Posted April 1, 2014 Author Share Posted April 1, 2014 (edited) I am declaring the variable as $current_date = date('d/m/Y'); In the hookLeftColumn function of my module. The error my browser throwing is "parse error: unexpected $current_date. Edited April 1, 2014 by sarfaraz.r1406 (see edit history) Link to comment Share on other sites More sharing options...
sarfaraz.r1406 Posted April 2, 2014 Author Share Posted April 2, 2014 Please reply soon. I have to sort out these problem soon. Regards Link to comment Share on other sites More sharing options...
vekia Posted April 2, 2014 Share Posted April 2, 2014 $current_date = date('d/m/Y'); this is okay but you trying to use this variable somewhere else? Link to comment Share on other sites More sharing options...
sarfaraz.r1406 Posted April 2, 2014 Author Share Posted April 2, 2014 This is giving error where I am assigning the value. So no meaning of using it anywhere. I am attaching the file where i am trying to use it. Please tell where I am going wrong. public function hookLeftColumn( $params ) { global $smarty; //public $current_date; $this->context->smarty->assign( array( // 'my_module_name' => Configuration::get('MYMODULE_NAME'), // 'my_module_link' => $this->context->link->getModuleLink('mymodule', 'display'), 'my_module_message' => $this->l('This is a simple text message'), ) $current_date = date("d/m/Y"); $smarty->assign('current_date',$current_date); ); return $this->display(__FILE__,'mymodule.tpl'); } Regards Link to comment Share on other sites More sharing options...
vekia Posted April 2, 2014 Share Posted April 2, 2014 $this->context->smarty->assign( is unclosed you have to close it (see red closing sign) $this->context->smarty->assign( array( // 'my_module_name' => Configuration::get('MYMODULE_NAME'), // 'my_module_link' => $this->context->link->getModuleLink('mymodule', 'display'), 'my_module_message' => $this->l('This is a simple text message'), ) ); $current_date = date("d/m/Y"); $smarty->assign('current_date',$current_date); ); Link to comment Share on other sites More sharing options...
sarfaraz.r1406 Posted April 2, 2014 Author Share Posted April 2, 2014 That was a silly thing Thanks for the help. I will be really greatfull if you can help me with this problem too. : http://www.prestashop.com/forums/topic/320336-unable-to-call-a-custom-hook/ Regards Link to comment Share on other sites More sharing options...
Recommended Posts