CodeIgniter Forums
Modular Extensions - Problem including view file - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Modular Extensions - Problem including view file (/showthread.php?tid=13984)



Modular Extensions - Problem including view file - El Forum - 12-14-2008

[eluser]JasonS[/eluser]
I am having some trouble loading a view within a module.

This is my file structure.

/helper/general_helper.php
/modules/admin/controllers/user.php
/view/message.php

The general_helper file has the following function in it.

Code:
function message($title="", $message="", $redirect="")
{
    if ($redirect=="")
        $redirect = base();
        
    $ci =& get_instance();
    $data['title']        = $title;
    $data['message']     = $message;
    $data['redirect']    = $redirect;    
    $ci->load->view('message', $data);
}

When I call this function from a controller in the 'controller' folder everything works fine. The view file loads.

If I call this function from user.php which is in the modules folder, I get an error message that the view file cannot be found. Does anyone know why this is happening? Without putting a duplicate view file in each module, is there another solution to this?