TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Need to form the SEO based urls in kohana 3.3
  • Dear team,

    I want to form the SEO based URL in application. I have created two static pages and called in same controller. I am facing issues in calling those Action. Please check it and give the exact solution.

    Controller name : Site
    
    Please find the my controller code here:
    //about us
        public function action_aboutus() {      
            
            //view
            $view = View::factory( 'default/aboutus' );
            $this->template->content = $view;       
        }
        
        //contact us
        public function action_contactus() {        
            //view
            $view = View::factory( 'default/contactus' );
            $this->template->content = $view;       
        }
    
    My route here:
    
    Route::set('site', '< path >.html',
      array(
        'path' => '[a-zA-Z0-9_/]+',
      ))
      ->defaults(array(
        'controller' => 'Site',
        'action' => 'aboutus',
      ));
    
    

    My issues is that, I am trying to call aboutus.html, which is working fine. But while I am trying to access contactus.html which is not working. Please let me know what to do here?

  • rename to , that should do the trick ^^

  • @saranraj Please try this Route::set('aboutus', 'aboutus.html') ->defaults(array( 'controller' => 'site', 'action' => 'aboutus', ));

    Route::set('contactus', 'contactus.html') ->defaults(array( 'controller' => 'site', 'action' => 'aboutus', ));

  • You did not define action in route. Your action is always "aboutus" as default. And path is param for this action. You should try this:

    Route::set('site', '< action >.html',
      array(
        'action' => '[a-zA-Z0-9_/]+',
      ))
      ->defaults(array(
        'controller' => 'Site',
        'action' => 'aboutus',
      ));
    

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion