0

I am trying to build a CodeIgniter application with my index.php inside a "public" folder /Applications/MAMP/htdocs/public/ in the website root. I have setup my vhosts etc to point to this index.php file. I wanted to go for a module based approach and so ended up using Modular Extensions - HMVC . I placed the core files and the third party files in the corresponding folders, and created a modules folder in the application folder. I then proceeded to create a "login" module inside the modules folder alongwith the required "controllers/login.php" , "models" and "views"

class Login extends MX_Controller{
    public function index()
    {
        log_message('error','reached module');
    }
}

Now when i try to load http://localhost/login , I get an error log in apache_error.log saying

File does not exist: /Applications/MAMP/htdocs/public/login

http://localhost works fine displaying the welcome screen of CodeIgniter gniter

This is the path structure :

application/modules
└── login
    ├── config
    │   └── routes.php
    ├── controllers
    │   └── login.php
    └── views
        └── login.view.php

Content of modules/login/config/routes.php

<?php
$route['login'] = 'login';

httpd-vhosts config :

<VirtualHost *:80>
    DocumentRoot "/Applications/MAMP/htdocs/public"
    SetEnv APP_ENV development

    <Directory "/Applications/MAMP/htdocs/public">
        Options Indexes FollowSymLinks Includes execCGI
        AllowOverride All
        Order Allow,Deny
        Allow From All
    </Directory>
</VirtualHost>
jagzviruz
  • 1,453
  • 12
  • 27
  • Aren't you supposed to use modules::run('module/login', $params, $...) instead of $this->load->view ? – Christian Bonato May 29 '14 at 22:52
  • try some thing $application_folder = '../application'; just a idea might work, think of where your applications folder is. –  May 30 '14 at 03:00
  • have updated `$application_folder` .. otherwise it would not work from inside the `public`folder – jagzviruz May 30 '14 at 03:05
  • @Bonatoc - have tried that as well... I added a log message in the index() but it never reached there .. – jagzviruz May 30 '14 at 03:13
  • is controller in modules folder modules/folder/file in routes may need also to add $route['controllername'] "folder/controllername/index"; and to get default controller or route to work in sub folder just add the index on the end. Must be in modules folder in application. –  May 30 '14 at 03:17
  • @acoderslife : tried it.. but same error. I am beginning to think this does not have anything to do with my CI code but rather my vhosts .. following is my vhosts config( added to question ) – jagzviruz May 30 '14 at 03:32
  • Ok Sorry not sure on vhost I use xammp when developing and then when use cpanel when on main server –  May 30 '14 at 04:44

1 Answers1

1

I finally managed to get my code working. Wrote a small tutorial around it on setting up. You can refer it here

jagzviruz
  • 1,453
  • 12
  • 27