Hi, I am a Newbie and have been using CI for a while, and have just started with HMVC. I have modified the files etc as in the Modular Extensions 5.4 (Bitbucket) and it works fine.
My question is?
I have just set up 2 modules Module: Base (originally the welcome one) and another Module: Register.
I am experimenting with running the Module register from within the base Module/view file thus:
<div id="container">
<h1>Welcome to CodeIgniter!</h1>
<div id="body">
The page you are looking at is being generated dynamically by CodeIgniter.
If you would like to edit this page youll find it located at:
<code>application/views/welcome_message.phpapplication/controllers/welcome.php
If you are exploring CodeIgniter for the very first time, you should start by reading the User Guide.
</div>
Page rendered in {elapsed_time} seconds
?php echo Modules::run('register/register/index'); ?>
</div></code>
As I understand it this is a view partial?
Which I can access with the url: http://localhost/CI-HMVC/index.php/ and it loads the base module fine and also the Register Module within it.
Now if I enter http://localhost/CI-HMVC/index.php/register I can also access the Register Module directly on its own, which of course looks bad as it is not loading any of the CSS etc of the base view.
Is there a way to prevent direct access to a Module Method unless it it is called/run from another Module, in this case ‘BASE’?
Here is the simple Register Module:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Register extends CI_Controller {
/**
*/
public function index()
{
$this->load->view('register');
}
}Many thanks, Alan