0

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.

4
  • Is this all part of the same addon? EE version? Whats the folder structure for this look like?
    – Jim Wyse
    Apr 12, 2017 at 14:54
  • Apologies, I've added a bit more information to the question. There are two addons; one extension (1st block of code) and a module (2nd block) and the site is running EE 3.5.3. Apr 12, 2017 at 15:29
  • 1
    My intuition tells me that I would combine these together. You can have a module and extension in the same addon. Managing dependencies across separate addons doesn't seem like a lot of fun.
    – Jim Wyse
    Apr 12, 2017 at 16:00
  • Thanks Jim. I reckon you're right, it makes sense really. Apr 12, 2017 at 16:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.