Question

I'm trying to add custom pages to user model.

If I would be making simple pages I would simply create controller in my application\classes\controller and a view file in \application\views, but now I would like to do same thing with user module.

I found view files in modules\user\views\user but I can't find controller or anything else what is loading them.

I've tried to simply make new file called test.php and then navigated to localhost/user/test but get an error:

The requested URL user/test was not found on this server.

If i would try localhost/user/profile everything works just fine. What am I doing wrong here?

Was it helpful?

Solution

If localhost/user/profile works for you, there should be a function called action_profile() somewhere in that user module.

Do a global search for "action_profile" and you should be able to find the controller file that is serving that URL. Then, you can add another action for the new page that you want to add.

Or, you may be able to add a controller to that same directory if you specifically want a new controller.

Either way, if it doesn't work, you may need to modify the routes (in your bootstrap or in the module's init.php file).

OTHER TIPS

Do yourself a favour and go read about the Cascading File System. Basically anything that uses Kohana::find_file() - which the Kohana core uses a lot - should be about to find the files you are looking for in modules.

Since your webserver tries to serve you a webroot/user/test, which it can't, it will be forwarded to Kohana. Kohana will then try to match 'user/test' to a route. Which in your case it can since do do not get the 'Unable to find a route to match the URI: user/test' exception. Kohana does not come with a controller which handles what you want.

There are some modules out there which suit your needs if I understand them correctly. Most likely they will have 'media' of 'assasts' in there name, like this one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top