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

Centralized download area

Finally, we come to the actual download area. This just needs to be a simple controller, which lists the users' entries from the access table, along with links to the corresponding downloads.

Our controller needs to query the database, cache the results, and add them to a template tag. Obviously, the controller also needs to check that the user is logged in; otherwise, an error message should be displayed.

private function listDownloads() { $this->registry->getObject('template')-> buildFromTemplates('header.tpl.php', 'downloads.tpl.php', 'footer.tpl.php'); $u = $this->registry->getObject('authenticate')->getUserID(); $sql = "SELECT p.name, d.file FROM content c, content_types_products p, download_access d WHERE c.ID=d.product ...

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