SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: url routes?

  1. #1
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    url routes?

    I'm trying to implement URL routing into my web app but struggling, i've followed the mvc structure so urls are /controller/class

    i want to be able to change '/profile/edit_profile' to '/edit-profile'.

    I've done something similar in CodeIgniter in routes.php i would add

    $route['edit-profile'] = 'profile/edit_profile';

    but can't think of the logical way to code this

    thanks

  2. #2
    SitePoint Guru bronze trophy TomB's Avatar
    Join Date
    Oct 2005
    Location
    Milton Keynes, UK
    Posts
    989
    Mentioned
    9 Post(s)
    Tagged
    2 Thread(s)
    There are essentially two ways of doing it:

    -A routing table, mapping each possible route to a controller/controller acton.

    -Convention over configuration: Taking a best guess approach and having a standardised URL format for routing. e.g. /controller-action/foo/bar maps to $controller->action('foo', 'bar');

    I wrote about this in some detail here: http://r.je/mvc-php-front-controller.html

  3. #3
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'll have a read thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •