Search code examples
phpcodeigniter

how to duplicate a page in codeigniter?


I'm new to codeigniter environment. I have this existing system and I am trying to duplicate one of the admin pages which I thought would work if i just copy, rename and paste.

Example:

(original files and working)

application\controllers\admin\calculator.php

application\views\admin\calculator.php

it can be access by domain.org/admin/calculator

(duplicated)

application\controllers\admin\calculatorduplicate.php

application\views\admin\calculatorsduplicate.php

tried accessing by domain.org/admin/calculatorduplicate but showing 404

I also added the navigation link inside this file.

application\views\admin\header.php

What am i missing? I didn't want to change anything inside the file yet, just want to duplicate the page. Please help.


Solution

  • Firstly, first try to understand how CodeIgniter binds its URLs.

    In URL:

    http://codeignitersite.com/controller/method/parameter_one/parameter_two/[parameters].....

    Controller is the Controller class which must have the same name as of its Filename and also as in URL.

    Method is the Controller method to be accessed.

    In above case, the class name also needs to be changed to:

    class Calculatorduplicate {

    To avoid any 404 error.