Welcome Guest, Not a member yet? Register   Sign In
HMVC - set default route
#1

(This post was last modified: 10-26-2015, 04:38 AM by Lykos22.)

Hi, I'd like some help please. I'm using CI v.3.0.2 and I have set up HMVC modularity from wiredesignz, so my folder structure look like this

Code:
- application
---- modules
-------- posts
----------- controllers
--------------- Admin.php
--------------- Post.php
----------- models

I have aslo set the routes for my "admin" pages like this, which works great

PHP Code:
$route['admin/([a-zA-Z_-]+)/(:any)'] = '$1/admin/$2';
$route['admin/([a-zA-Z_-]+)/(:any)/(:num)'] = '$1/admin/$2/$3';
$route['admin/login'] = 'admin/login';
$route['admin/logout'] = 'admin/logout';
$route['admin/([a-zA-Z_-]+)'] = '$1/admin/index';
$route['admin'] = 'admin'

I want to set up as default route the Post.php for the front end, so when I tried:

PHP Code:
$route['default_controller'] = 'post';

// or 

$route['default_controller'] = 'post/index'

I get a 404 error. Could you tell me what I'm doing wrong and how to fix this ?
Reply
#2

(10-26-2015, 04:37 AM)Lykos22 Wrote: Hi, I'd like some help please. I'm using CI v.3.0.2 and I have set up HMVC modularity from wiredesignz, so my folder structure look like this



Code:
- application
---- modules
-------- posts
----------- controllers
--------------- Admin.php
--------------- Post.php
----------- models

In that source structure, you have a folder "posts" (plural), and a controller "Post.php" (singular)

Reply
#3

(10-26-2015, 04:43 AM)davicotico Wrote: In that source structure, you have a folder "posts" (plural), and a controller "Post.php" (singular)

You mean it should be set as


PHP Code:
$route['default_controller'] = 'posts'
 
Reply
#4

(10-26-2015, 05:10 AM)Lykos22 Wrote:
(10-26-2015, 04:43 AM)davicotico Wrote: In that source structure, you have a folder "posts" (plural), and a controller "Post.php" (singular)

You mean it should be set as



PHP Code:
$route['default_controller'] = 'posts'
 


I meant that the Controller folder name should be the same as the main controller file name. 
-modules
- - post/
- - - - controllers/
- - - - - - Post.php
- - - - - - Admin.php

Reply




Theme © iAndrew 2016 - Forum software by © MyBB