O'Reilly logo

Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started by Charlie Arehart, Raymond Camden, Ben Forta

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

Encapsulating the Shopping Cart in a Custom Tag

Although the version of StoreCart.cfm in Listing 22.4 works just fine, the code itself is a bit messy. It contains quite a few list functions, which don’t necessarily have to do with the conceptual problem at hand (the user’s cart). Worse, other templates that need to refer to the user’s cart (such as the Checkout template) must use nearly all the same list functions over again, resulting in quite a bit of code for you to maintain.

You will learn about Custom Tags in Chapter 25, “Creating Custom Tags,” in Vol. 2, Application Development. This early example is rather simple, but if you find it confusing, read ahead to Chapter 25.

Building <cf_ShoppingCart>

The code in Listing 22.5 creates a Custom ...

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