简体   繁体   中英

Anchors in CodeIgniter like in Ruby on Rails

in Ruby on Rails i can generate links like <%= link_to 'Name', :controller => 'controller_name', :action => 'action_name' %> . This alos works when i have changed the route for this url.

Is it possible to get something like this in CodeIgniter with the anchor when i have defined custom routes?

I hope it is understandable ;)

Thanks for help

Depending on your codeigniter project configuration, you can create simple html links with href attribute set to /index.php/controller/action or /controller/action . I am not sure if there are any link helpers present.

If you have custom routes set in application/config/routes.php then they won't be executed by the anchor function, you will have to extend the URL helper and redefine this function by passing your custom routes. Hope that helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM