Welcome Guest, Not a member yet? Register   Sign In
Locating A View File in An HMVC approach
#1

[eluser]xtremer360[/eluser]
I am using codeigniter for my application and developing with HMVC approach with the added package here:

https://bitbucket.org/wiredesignz/codeig...sions-hmvc

I have a custom template I created for my views and in my content view have the following lines:

Code:
if ((!isset($page_view)) || (is_null($page_view)) || (!file_exists(APPPATH . 'views/backend/' .     $this->cms_template . '/cpanel/pages/' . $page_view . '.php')))
{
    $this->load->view('backend/' . $this->cms_template . '/cpanel/template/page_unknown_view');
}
else
{
    $this->load->view('backend/' . $this->cms_template . '/cpanel/pages/' . $page_view);
}

?>

This works when there are views in the folder but since some of my views will be in a different folder for this HMVC approach it always shows up as my unknown page file. How should I modify so that it works with this approach.


EDIT: Let me try and rephrase all of this. This is my file system...

Code:
/application/views/backend/{templatename}/cpanel/index_view
/application/views/backend/{templatename}/cpanel/template/(header.php, footer.php, content.php)
/application/modules/users/controllers/users
/application/modules/users/views/users_view

Lets say the users controller loads the cpanel view as its main view page which loads the three template pages. Being the header, footer and content page. Inside of the content page it performs the if statement as seen above. It gets sent a variable that finds out which controller specific view to load. IN this instance I want it to load the users_view file. So with my if statement I need it to find out if its a file that exists somewhere in that module's folder.

Does this help at all?
#2

[eluser]xtremer360[/eluser]
Any ideas?




Theme © iAndrew 2016 - Forum software by © MyBB