code igniter hmvc templates not working

605 views Asked by At

I have this templates folder in my new hmvc project that I am setting up.

For my controllers

Template.php codes

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Template extends MX_Controller{

    function view(){

        $this->load->view('one_view');
    }
}

?>

one_view.php

<h1>Hello</h1>

When I go to my browser and type:

localhost/ci_hmvc/templates/view

it always says that 404 Page Not Found. No matter what tutorial I watch its almost the same code and I copied every code they use but it doesnt work.

P.S: I am using htaccess so theres no index.php in my url.

1

There are 1 answers

5
devpro On BEST ANSWER

It should be:

localhost/ci_hmvc/template/view

Your controller and file name is Template and Template.php not Templates

Side Note:

Or if you still want to use as templates than add route for this controller as:

$route['templates'] = "template";

Second solution is that, change your file and controller name as templates.