Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPKitchen:
Building accessibility URLs
Aug 09, 2005 @ 11:17:44

PHPKitchen has a new post today with some information and a look at a handy little bit of functionality that can be used to make "more friendly" URLs for your site.

Building accessibility URLs is easy with a function that returns an URL from the given arguments. It supports arguments in the most common formats like index.php?articles=foo&page=2 and /articles/foo/page/2 and array('articles' => 'test', 'page' => 2). It converts the parsed arguments and returns a complete url string. This way you always have consistent urls no matter what your data looks like.

If you prefer FriendlyURLs it returns /articles/test/page/2 if not it returns articles=test&page=2.

The buildURL class allows you to easily create and use these kinds of URLs as well as translating them back the other way. It's a nice little script to drop into an existing site to create this kind of functionality, and it's simple enough to where it can be adjusted easily if the need arises...

tagged:

Link:


Trending Topics: