dqhendricks
dqhendricks

Reputation: 19251

controller class naming convention conflict (php)

I am building an MVC framework. I am using the PEAR naming convention. Classes have the first letter of each word capitolized.

The problem is when I get to the controller classes. The framework loads the controller based on the URL path. I do not however want to need uppercase letters in my URLs. Is there a common way to deal with this problem?

Upvotes: 1

Views: 637

Answers (1)

halfdan
halfdan

Reputation: 34234

Just fetch the name of the controller from the url (e.g. /controller/action/id) and use ucfirst() to get the class name of your controller. That's the common way to do it.

Upvotes: 3

Related Questions