Part of the EllisLab Network
   
 
HMVC Issue
Posted: 19 May 2009 02:36 AM   [ Ignore ]  
Summer Student
Total Posts:  7
Joined  05-19-2009

Hi All,

  I have decided to use Modular extension in my CI project.
I have downloaded the ME libraries and stored them in ./system/application/libraries.
Now I have
  - Controller.php
  - Modules.php
  - MY_Router.php
in application/libraries.

My Config file has….

/* Detect ssl connectivity */
if ( isset($_SERVER['HTTPS']) ) 
    
$ssl $_SERVER['HTTPS'];
elseif ( isset(
$_SERVER['HTTP_FRONT_END_HTTPS']) )
    
$ssl $_SERVER['HTTP_FRONT_END_HTTPS'];
else 
    
$ssl "OFF";

$root = (stripos($ssl"ON") !== FALSE) ? "https" "http";

/* Many pages/apps served through the same domain */

if ( isset($_SERVER['HTTP_X_FORWARDED_HOST']) ) {
    
list($host) = explode(','str_replace(' '''$_SERVER['HTTP_X_FORWARDED_HOST']));
else {
    $host 
$_SERVER['HTTP_HOST'];
}

$root 
.= "://".$host;

if ( ! isset(
$_SERVER['ORIG_SCRIPT_NAME']) )
{
  $root 
.= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
}
else
{
  $root 
.= str_replace(basename($_SERVER['ORIG_SCRIPT_NAME']),"",$_SERVER['ORIG_SCRIPT_NAME']);
}

$config[
'base_url'"$root"

Then I created Sub Modules under Application. Now my directory looks like…

./system/application
                /staffprofilemanagement
                                  /admin
                                        /controllers
                                                /crEntityCntrlr.php
                                        /views
                                        /models
                                        /libraries
                                        /config

Then I try to access using the url….

http://localhost/staffprofilemanagement/admin/index.php/crEntityCntrlr/loadCollege

I’m getting the error 404 File not found.
Please anybody solve this issue.

Profile
 
 
Posted: 19 May 2009 04:20 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
RankRankRank
Total Posts:  390
Joined  04-21-2009

Use the code-button right over the textarea to highlight your code. That makes it easier to follow.

/* Detect ssl connectivity */
if ( isset($_SERVER[‘HTTPS’]) )
  
$ssl $_SERVER[‘HTTPS’];
elseif ( isset(
$_SERVER[‘HTTP_FRONT_END_HTTPS’]) )
  
$ssl $_SERVER[‘HTTP_FRONT_END_HTTPS’];
else
  
$ssl “OFF”;

$root = (stripos($ssl“ON”) !== FALSE) ? “https” “http”;

/* Many pages/apps served through the same domain */

if ( isset($_SERVER[‘HTTP_X_FORWARDED_HOST’]) ) {
  
list($host) = explode(,str_replace(’ ‘‘’$_SERVER[‘HTTP_X_FORWARDED_HOST’]));
else {
  $host 
$_SERVER[‘HTTP_HOST’];
}

$root 
.= ://”.$host;

if ( ! isset($_SERVER[‘ORIG_SCRIPT_NAME’]) )
{
  $root 
.= str_replace(basename($_SERVER[‘SCRIPT_NAME’]),”“,$_SERVER[‘SCRIPT_NAME’]);
}
else
{
  $root 
.= str_replace(basename($_SERVER[‘ORIG_SCRIPT_NAME’]),”“,$_SERVER[‘ORIG_SCRIPT_NAME’]);
}

$config[‘base_url’] 
“$root”
 Signature 

I love the smell of code in the morning.

Profile
 
 
Posted: 19 May 2009 04:29 AM   [ Ignore ]   [ # 2 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  3198
Joined  06-10-2007

try

./system/application
        
/modules
                
/staffprofilemanagement
                       
/controllers
                                crEntityCntrlr
.php
                       
/views
                       
/models
                       
/libraries
                       
/config 

the URL is malformed also

/* http://localhost/staffprofilemanagement/admin/index.php/crEntityCntrlr/loadCollege */
http://localhost/index.php/staffprofilemanagement/crEntityCntrlr/loadCollege 
 Signature 

URI Language Identifier | Modular Extensions - HMVC | View Object | Widget plugin | Access Control library

Profile
 
 
Posted: 19 May 2009 04:52 AM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  7
Joined  05-19-2009

Soory Not working with the URLs

http://localhost/staffprofilemanagement/admin/index.php/crEntityCntrlr/loadCollege
http://localhost/modules/staffprofilemanagement/admin/index.php/crEntityCntrlr/loadCollege

Any setup I should have??????????

I use PHP5.

Profile
 
 
Posted: 19 May 2009 04:59 AM   [ Ignore ]   [ # 4 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  3198
Joined  06-10-2007

Yes you should have a working CodeIgniter setup.

Neither of those URLs would work with ordinary CI let alone with HMVC.

For you I recommend making your code function as a normal application before you move it into a module.

Once you have an understanding of CI application structure then you can use modules more easily.

 Signature 

URI Language Identifier | Modular Extensions - HMVC | View Object | Widget plugin | Access Control library

Profile
 
 
Posted: 19 May 2009 05:30 AM   [ Ignore ]   [ # 5 ]  
Summer Student
Total Posts:  7
Joined  05-19-2009

Actually I had been running my code with CI without modularising.

The same controller (crEntityCntrlr.php) was working fine before.

But I wanted to have many modules work together. So putting files of all modules inside controller would make confusion. So I downloaded ME to libraries. I knew I miss some setup but couldn’t figure out. If you could help me then it will be fine.

Profile
 
 
Posted: 19 May 2009 08:14 AM   [ Ignore ]   [ # 6 ]  
Summer Student
Total Posts:  7
Joined  05-19-2009

Can Anyone give me a clear idea about the Directory structure of CI being modularized, The setup and Calling info…........

Profile
 
 
Posted: 19 May 2009 08:52 AM   [ Ignore ]   [ # 7 ]  
Summer Student
Total Posts:  7
Joined  05-19-2009

Some how I tried to fix the problem and got struc with some other error.

“The configuration file config.php does not exist.”

Please Help…......

Actually I changed the url to

http://localhost/index.php/staffprofilemanagement/crEntityCntrlr/loadCollege

and got the above error.

Profile
 
 
Posted: 19 May 2009 10:37 AM   [ Ignore ]   [ # 8 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  3198
Joined  06-10-2007

Modules directory structure image is attached.

Image Attachments
Untitled-1.gif
Click thumbnail to see full-size image
 Signature 

URI Language Identifier | Modular Extensions - HMVC | View Object | Widget plugin | Access Control library

Profile
 
 
Posted: 19 May 2009 01:56 PM   [ Ignore ]   [ # 9 ]  
Summer Student
Total Posts:  7
Joined  05-19-2009

As per above directory structure I Used…

system/
system/application/
system/application/modules/
system/application/modules/staffPMS/
system/application/modules/staffPMS/admin/
system/application/modules/staffPMS/admin/controllers/
system/application/modules/staffPMS/admin/controllers/crEntityCntrlr.php

But I’m getting the following error for URL


http://localhost/index.php/staffPMS/admin/crEntityCntrlr/loadCollege


An Error Was Encountered
Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.

Needed Help…......

Profile
 
 
Posted: 19 May 2009 10:56 PM   [ Ignore ]   [ # 10 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  3198
Joined  06-10-2007

You may use sub-directories in the apliccation/controllers directory and in any other application/directories and also in your module/directories EXCEPT for module/controllers.

Loading controllers from module/controller sub directories is not functional, you are welcome to modify MY_Router.php to search that deep if you wish.

 Signature 

URI Language Identifier | Modular Extensions - HMVC | View Object | Widget plugin | Access Control library

Profile
 
 
Posted: 19 May 2009 11:40 PM   [ Ignore ]   [ # 11 ]  
Summer Student
Total Posts:  7
Joined  05-19-2009

Thanx wiredesignz….........
I use modules for models

Profile