Jump to content

Recommended Posts

I have created a new module with template. I call my module and my template in my custom hook. It work fine. But I want to call another existing module in my custom hook and I don't want to override this module because if it's deleted my module will certainly crash. So there is a solution to call this existing module with my custom hook or it is simply impossible ? I try too do this manually in the back office but it's work with "displayLeftColumn" and "displayRightColumn" but not with my custom hook.

Link to comment
Share on other sites

Thank you for your reply.

I make some search with what you shared me and I do this :

In my class :

class myClass extends Module {
	myFunction(){
		$module = Module::getInstanceByName('nameOfModuleIWant');
    	return $module;
	}
}

In my hook :

hookDisplayMyHook(){
	$this->context->smarty->assign([
		'myVariable' => $this->myClass->myFunction(),
	]);
	return $this->display(_FILe_, 'myTemplate.tpl');
}

In my template :

{include file=tpl_Path_I_Want/tpl_File_I_Want.tpl' listing=$myVariable}

and this work fine.

Edited by Yohannn (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...