Welcome Guest, Not a member yet? Register   Sign In
Problem setting routes in HMVC
#1

(This post was last modified: 05-30-2016, 01:54 AM by bebetxx.)

Hello guys,

I am quite new to CodeIgniter and MVCs. I started working on this new project and installed the HMVC from wiredesignz . I encounter a HMVC routing problem and this thing drives me CRAZY!

My problem is that my routing is not working properly. I write you the details of my CI3 project.

application/config
   config.php

PHP Code:
$config['base_url'] = 'http://localhost/Hub2/';

$config['index_page'] = '';
....

$config['modules_locations'] = array(
   APPPATH.'modules/' => '../modules/'
); 


   routes.php

PHP Code:
//$route['(:any)'] = 'pages/view/$1';
$route['login'] = 'authentication/login/index';
$route['awesome'] = 'pages/pages/index';
$route['default_controller'] = 'pages/pages/view';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE

   application/modules/authentication/controllers/Login.php
   application/modules/authentication/model/User.php
   application/modules/authentication/view/login_box.php

   application/modules/pages/controllers/Pages.php
   application/modules/pages/view/template/.......

my .htacess from the root directory

Code:
<IfModule mod_rewrite.c>
  RewriteEngine On
  # !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
  #  slashes.
  # If your page resides at
  #  http://www.example.com/mypage/test1
  # then use
  # RewriteBase /mypage/test1/
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

Here is my Login Class:


PHP Code:
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');


class 
Login extends MY_Controller
{

    function __construct()
    {
        parent::__construct();

        $this->sModuleName='authentication';
    }

    public function index()
    {
        echo "Login";
    

MY_Controller

PHP Code:
class MY_Controller extends MX_Controller
{

    public $data = array();
    public $sModuleName='';

    function __construct()
    {
        parent::__construct();
        $this->sModuleName get_class($this);

        $this->data['g_sWebsiteName'] = "SkyHUB";
        $this->data['g_sLanguage'] = "en";
    }

    function my_view($path,$data=NULL,$bDisplay=false)
    {
        return $this->load->view('../modules/'.$this->sModuleName.'/views/'.$path,$data,$bDisplay);
    }




When I can access the following links: 
http://localhost/Hub2/ returns me correctly the Modules/Pages/Controllers/Pages/View

http://localhost/Hub2/login returns me Not Found. The requested URL /Hub2/login was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

http://localhost/Hub2/awesome returns me Not Found. The requested URL /Hub2/awesome was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

http://localhost/Hub2/index.php/login returns me correctly the Modules/Authentication/Controllers/Login/Index
http://localhost/Hub2/index.php/awesome returns me correctly the Modules/Pages/Controllers/Pages/Index
Reply


Messages In This Thread
Problem setting routes in HMVC - by bebetxx - 05-30-2016, 01:17 AM
RE: Problem setting routes in HMVC - by InsiteFX - 05-30-2016, 04:02 AM
RE: Problem setting routes in HMVC - by bebetxx - 05-30-2016, 04:30 AM
RE: Problem setting routes in HMVC - by InsiteFX - 05-30-2016, 10:12 AM
RE: Problem setting routes in HMVC - by bebetxx - 05-31-2016, 06:23 AM
RE: Problem setting routes in HMVC - by InsiteFX - 05-31-2016, 08:35 AM
RE: Problem setting routes in HMVC - by bebetxx - 05-31-2016, 09:06 AM
RE: Problem setting routes in HMVC - by kilishan - 05-31-2016, 09:31 AM
RE: Problem setting routes in HMVC - by bebetxx - 05-31-2016, 09:56 AM
RE: Problem setting routes in HMVC - by InsiteFX - 05-31-2016, 10:20 AM
RE: Problem setting routes in HMVC - by bebetxx - 06-01-2016, 12:39 PM
RE: Problem setting routes in HMVC - by InsiteFX - 06-01-2016, 12:47 PM
RE: Problem setting routes in HMVC - by bebetxx - 06-01-2016, 12:53 PM
RE: Problem setting routes in HMVC - by InsiteFX - 06-01-2016, 01:08 PM
RE: Problem setting routes in HMVC - by bebetxx - 06-01-2016, 01:14 PM
RE: Problem setting routes in HMVC - by InsiteFX - 06-01-2016, 01:44 PM
RE: Problem setting routes in HMVC - by InsiteFX - 06-01-2016, 01:46 PM
RE: Problem setting routes in HMVC - by bebetxx - 06-01-2016, 02:00 PM
RE: Problem setting routes in HMVC - by cartalot - 06-01-2016, 05:53 PM
RE: Problem setting routes in HMVC - by bebetxx - 06-01-2016, 10:00 PM
RE: Problem setting routes in HMVC - by InsiteFX - 06-01-2016, 06:04 PM
RE: Problem setting routes in HMVC - by bebetxx - 06-02-2016, 02:35 AM
RE: Problem setting routes in HMVC - by InsiteFX - 06-02-2016, 03:25 AM
RE: Problem setting routes in HMVC - by InsiteFX - 06-02-2016, 05:36 AM
RE: Problem setting routes in HMVC - by bebetxx - 06-02-2016, 09:05 AM
RE: Problem setting routes in HMVC - by InsiteFX - 06-02-2016, 09:07 AM
RE: Problem setting routes in HMVC - by bebetxx - 06-03-2016, 06:43 AM
RE: Problem setting routes in HMVC - by InsiteFX - 06-03-2016, 07:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB