Edit
I have two separate add-ons in play here with EE 3.5.3
- addons/project/ext.project.php
- addons/project_mailer/mod.project_mailer.php
- addons/project_mailer/views/mail_template.php
I've got an extension set up that includes a module file, so that I can call a function from it later on (see below).
<?php
/**
* File: ext.project.php
**/
if ( ! class_exists( 'Project_mailer' ) )
{
require_once( PATH_THIRD . 'project_mailer/mod.project_mailer.php' );
}
// Code and stuff
$mailer = new Project_mailer();
$mailer->send_mail_update( $entry_id, $channel_id );
?>
This is all working fine and the function is called however when I try to load a view from it I'm getting an error: Unable to load the requested file: mail_template.php
My assumption is that because I'm creating a new instance of the class it's looking for the view file relative to my extension rather than the module? (Correct me if I'm wrong on that though)
I've attached a copy of the code within the send_mail_update
function below. I tried to use the commented out line instead however the same error appears but with the full path included.
<?php
/**
* File: mod.project_mailer.php
**/
public function send_mail_update( $entry_id, $channel_id )
{
// Code and stuff
return ee()->load->view( 'mail_template', $data, TRUE );
//ee()->load->view( PATH_THIRD . 'project_mailer/views/mail_template', $data, TRUE );
}
Is there any way to get the view to show correctly in my current set up?
Thank you.