TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Advanced PHP Programming (http://www.talkphp.com/advanced-php-programming/)
-   -   URL in MVC (http://www.talkphp.com/advanced-php-programming/5094-url-mvc.html)

Killswitch 11-07-2009 04:16 AM

URL in MVC
 
I have recently found and began playing around with MVC. I have a basic framework setup, the controller class, model class, an sql class, and so on. A basic app works ( well, I am just printing from the method so... ).

Anyways, the URL structure I was hoping to get "cleaner", as the current /controller/and/so/on/id/4 is not so great. Since I am new to MVC, I was wondering if you can rewrite or use PHP to rewrite these values so a URL of...

/content/view/id/5

Could be turned into...

/content/this-is-some-page

I wasn't quite sure how it would work, if it even could since the URL values are used to determine the methods called and so on.

I know Joomla does something similar, maybe very loosely based on MVC ( haven't checked out the new version ), but was wondering what you guys had to say on the subject?

dschreck 11-07-2009 06:53 AM

creating custom page URL's isn't that complicated. You'll just need to create a lookup system of some type, and store the look ups in a DB or in MC.

Killswitch 11-08-2009 02:11 AM

I don't think I understand. I know how to do it with mod_rewrite, but not sure if this would totally kill the functionality of MVC ( removing things such as view/id/5 making it 5.html or whatever ).

icosytech 11-22-2009 04:18 AM

Hi Killswitch,

Right now, I am also engaged in MVC development, you know well that index.php is the only entry point to the application, then what would be the exact problem in rewriting the URL as per your wish? But I didnt try the URL rewriting in MVC apps yet.

You have development your OWN framework right? But in my experience I am not sure that we can have strict MVC approach in PHP development. how about your framework ya?


All times are GMT. The time now is 09:27 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0