How do I turn tld.com/bures/oceanfront into tld.com/articles/view/bures/oceanfront in Kohana?

StackOverflow https://stackoverflow.com/questions/838161

  •  10-07-2019
  •  | 
  •  

Question

I'm using Kohana 2.3.2

Most, if not all, of the links on my site are to articles.

My controller is called Articles, and I have a method titled View. I don't want to prefix all my links with /articles/view/, so I'd like to set a default controller to handle all files.

I've looked into using a default router, which made tld.com use the Articles controller. However, when I try and access something like /bure/oceanfront/, I get Kohana's 404 Error.

I have looked at this article, but I believe it is outdated as the examples given are always error'ing (also see comments which point this out).

Was it helpful?

Solution

This is working now:

Event::add('system.post_routing' ,'call_fallback_page');



function call_fallback_page() {
        Router::$controller = 'Articles';
        Router::$method = 'index';
        Router::$controller_path = APPPATH.'controllers/articles.php';
}

Derived from the tutorial in the question.

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