coder_ Posted November 22, 2009 Share Posted November 22, 2009 Hor the last couple of weeks, my colleague and are in a discussion about framework's url routing. What do you think, which is better way to do the job. Dynamicaly checking route for for existing module/controller/action with no predefined routes or "hardcoded" route setting like it's done in zend framework. I know that both ways have their pros and cons, but i want to know other side. Other opinion. I noticed that every known framework uses the second, defined url route way. Where you directlly specify all application's routes. <?php $route = new Route('route_name', '/url/route/:some_variable', array('controller' => 'url', 'action' => 'route')); Quote Link to comment https://forums.phpfreaks.com/topic/182551-url-routes-dynamic-or-harcoded/ Share on other sites More sharing options...
448191 Posted November 22, 2009 Share Posted November 22, 2009 No, ZF does not use named routes only (unfortunately). There's the implied, unnamed route. Named routes (I wouldn't call them "hardcoded") have the advantage of some decoupling. You can change the routing and keep the handle, not having to change any controllers or views. Quote Link to comment https://forums.phpfreaks.com/topic/182551-url-routes-dynamic-or-harcoded/#findComment-963534 Share on other sites More sharing options...
coder_ Posted November 23, 2009 Author Share Posted November 23, 2009 No, ZF does not use named routes only (unfortunately). There's the implied, unnamed route. Named routes (I wouldn't call them "hardcoded") have the advantage of some decoupling. You can change the routing and keep the handle, not having to change any controllers or views. Ok, i know that zf has the ability of using unnamed routes, and thanks for the correction. But, what i would likt to hear from you is what way do like to implement. Named (predefined) or unnamed routing? Quote Link to comment https://forums.phpfreaks.com/topic/182551-url-routes-dynamic-or-harcoded/#findComment-963574 Share on other sites More sharing options...
448191 Posted November 23, 2009 Share Posted November 23, 2009 Well, considering decoupling is usually a good thing, I'd say named routes (the "unfortunately" didn't give it away?). Quote Link to comment https://forums.phpfreaks.com/topic/182551-url-routes-dynamic-or-harcoded/#findComment-963822 Share on other sites More sharing options...
coder_ Posted November 23, 2009 Author Share Posted November 23, 2009 Yes, it did. I understood your post. Thanks. Anyone else? Quote Link to comment https://forums.phpfreaks.com/topic/182551-url-routes-dynamic-or-harcoded/#findComment-964180 Share on other sites More sharing options...
Koobi Posted November 23, 2009 Share Posted November 23, 2009 shouldn't this have been posted in application design? i'm in the process of writing my own framework...i know it's not good to reinvent the wheel but i'm just not happy with the way most frameworks in PHP are implemented. but yeah, i would say i prefer named routes. Quote Link to comment https://forums.phpfreaks.com/topic/182551-url-routes-dynamic-or-harcoded/#findComment-964221 Share on other sites More sharing options...
448191 Posted November 23, 2009 Share Posted November 23, 2009 Uhm.. This *is* Application Design? Quote Link to comment https://forums.phpfreaks.com/topic/182551-url-routes-dynamic-or-harcoded/#findComment-964228 Share on other sites More sharing options...
Koobi Posted November 23, 2009 Share Posted November 23, 2009 Uhm.. This *is* Application Design? oops. thought i saw this in the PHP Coding section Quote Link to comment https://forums.phpfreaks.com/topic/182551-url-routes-dynamic-or-harcoded/#findComment-964247 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.