Code to Execute the ContentSelection Object

The following code shows how ContentSelector objects are typically created, used to select the content through the GetContent method, and write that content to the Web page.

The Default.asp file should include the following code:

<%
    ' Create a ContentSelector object.
    Set CSO = Server.CreateObject("Commerce.ContentSelector")

    ' Use the GetContent method to get some content. Use the dictionary
    ' previously created in the Global.asa file and referenced through the
    ' Application collection.
    Set Ads = CSO.GetContent(Application("CSFAdsContext"))
    ' Ads is a SimpleList containing the selected content.
    ' Write the content to the page, if any.
    For Each Ad in Ads
        Response.Write(Ad)
    Next
%>

Other, optional properties may be set on the ContentSelector object as well. These properties depend on the components in the selection pipeline and their configuration. The most common optional properties include UserProfile, NumRequested, PageGroup, and Size.


All rights reserved.