Skip to content

Modular Extensions FAQ

World Wide Web Server edited this page Jul 4, 2012 · 22 revisions

Category:Library::HMVC

[h2]Modular Extensions - FAQ[/h2]

[b]Q: What does the abbreviation ME stand for?[/b] [b]A:[/b] In forum threads and the wiki ME is used as a abbreviation for Modular Extensions.

[b]Q: How can I load a module from within a view?[/b] [b]A:[/b] Put the following line in your view file

[code] <?php echo modules::run('blog', $data, 'blog_read') ?> [/code]

Explenation: Module = The module you want to use (required). $data = The data which will be available in the method. This can be either be a string or an array. (optional) Method = The controller->method you want to use. The default method is index. (optional)

You may return a value as the output of a module controller or you can output a view or simply use echo, because the output is buffered and returned and should be echoed there as needed.

Example: [code] <?php class Blog extends Controller {

function blog()
{
    parent::Controller();   
}

function blog_read($id)
{
  $data['title'] = 'Title '. $id;
  $this->load->view('blog_read',$data);
}

} ?> [/code]

[b]Q: How can I make a difference between the front-end and the back-end (admin) of my web application?[/b] [b]A:[/b] There are more roads leading to Rome. One of your opportunities is to make two applications. But before you do this, you might want to split the application part and the system part of CodeIgniter as described at the wikipage Beter Server Setup for CI first. In the coming step-by-step plan I will however reference to CodeIgniter as it comes out of the box.

  1. Go to your 'system' directory.
  2. Copy the directory 'application', but paste it into the same directory. In Microsoft Windows Explorer your mapstructure will become like: [pre]
  • CodeIngiter_1_6_3
    • system (dir)
      • application (dir)
      • cache (dir)
      • codeigniter (dir)
      • database (dir)
      • fonts (dir)
      • helpers (dir)
      • language (dir)
      • libraries (dir)
      • logs (dir)
      • plugins (dir)
      • scaffolding (dir)
      • copy of application (dir)
    • user_guide (dir)
    • index.php [/pre]
  1. Rename the directory 'copy of application' and call it backend.
  2. Rename the directory 'application' and call it frontend.
  3. Create a new folder in the CodeIgniter_1_6_3 directory. For example: 'myadmin'.
  4. Copy the index.php file into 'myadmin'.
  5. Open CodeIngiter_1_6_3/index.php to change the application_folder variable (line 44) and give it the name of your frontend. In this example: $application_folder = "frontend";
  6. Open CodeIngiter_1_6_3/myadin/index.php to change the application_folder variable (line 44) and give it the name of your backend. In this example: $application_folder = "backend";
Clone this wiki locally