O'Reilly logo

PHP 5 e-commerce Development by Michael Peacock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Routing products and categories

The first part of our URL path should indicate the area of the site the user is trying to access, for example products. We need to maintain a list of active controllers in use by the framework, and if this part of the URL matches an active controller, we should include the controller file, create a controller object for that controller, and pass control of the framework to that controller. If the first part of the URL isn't an active controller, then we should include the page controller and pass control to that, which should in turn either display a page, or detect that the page isn't valid and therefore display a 404 error ("Page not found") page.

$activeControllers = array(); $registry->getObject('db')->executeQuery('SELECT ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required