-
Notifications
You must be signed in to change notification settings - Fork 4
Modular Extensions FAQ
[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.
- Go to your 'system' directory.
- 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]
- system (dir)
- Rename the directory 'copy of application' and call it backend.
- Rename the directory 'application' and call it frontend.
- Create a new folder in the CodeIgniter_1_6_3 directory. For example: 'myadmin'.
- Copy the index.php file into 'myadmin'.
- 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";
- 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";