I had a couple of annoyances when writing object oriented websites.
The first was lots of php files that did little more that instantiate my class. Having all these little files all over the web server seemed like an awful lot of clutter, and unnecessary.
The second was using mod-rewrite to create friendly URLs. Whenever I made a new friendly URL, I had to go in and edit the rewrite rules & restart the web server. So I wrote ObjectOrientedURLs
ObjectOrientedURLs lets you call class methods directly from URLs, without having to upload a PHP file that instantiates your class and calls the method. All you need to to is write method names that match up to the URLs on your website. To make a new page, all you need to do is write the class method and upload your class to the server.
I'd love to get a few eyeballs on the code, and some feedback.
You can check out the code and download the class, along with the .htaccess file, below.
http://www.davecomeau.net/blog/17/PHP+C ... ientedURLs
ObjectOrientedURLs
Moderator: General Moderators
Re: ObjectOrientedURLs
You need to take a look to the existing routers / front controllers before reinventing the wheel.
-
driverdave
- Forum Newbie
- Posts: 3
- Joined: Sun Sep 20, 2009 6:54 pm
Re: ObjectOrientedURLs
can you point me to one? i'd love to see what i'm re-inventing.
Re: ObjectOrientedURLs
CodeIgniter? and probably any MVC framework out there 
-
driverdave
- Forum Newbie
- Posts: 3
- Joined: Sun Sep 20, 2009 6:54 pm
Re: ObjectOrientedURLs
cool, thanks for pointing that out.
i can see my class has some characteristics of CodeIgniter. i'm not a huge fan of frameworks, and one of the reasons i wrote my class is to cut down on the amount of files on the server. it's my personal preference. i could rant on and on about PHP frameworks.
anyways, i guess i've received a coding critique, so thanks for the responses. i think i was wanting more of a critique of the actual code, but this will do for now.
i can see my class has some characteristics of CodeIgniter. i'm not a huge fan of frameworks, and one of the reasons i wrote my class is to cut down on the amount of files on the server. it's my personal preference. i could rant on and on about PHP frameworks.
anyways, i guess i've received a coding critique, so thanks for the responses. i think i was wanting more of a critique of the actual code, but this will do for now.