Documentation Center

Adding Search to Page Templates

The Search SmartTarget Template Building Block inserts code in your Web pages to implement Search functionality: to display Promotions based on search terms or synonyms of search terms.

Before you begin

To create templates you must have Template Management rights and Write permissions for the Folder in which you intend to create the template.

About this task

You can handle content items related to the search query using the Show SmartTarget Items Template Building Block.

Procedure

  1. Open Template Builder.
  2. Open or Create a Compound Page Template.
  3. Make sure your Dreamweaver template has <tcdl:region> tags, for example
    <tcdl:region id="Sidebar" type="SmartTarget"> 
    
    </tcdl:region>
  4. Add the Add SmartTarget Query Template Building Block after the Dreamweaver Template (or equivalent output) in your Page Template.
  5. Add the Search SmartTarget Template Building Block after the Add SmartTarget Query Template Building Block.
  6. Add the Show SmartTarget Items Template Building Block after the Search SmartTarget Template Building Block.
  7. Add the Apply SmartTarget Settings Template Building Block at the end of the Page Template.
  8. Select the Search SmartTarget Template Building Block and define the attributes:
    You can define the following attributes for Search SmartTarget:
    AttributeDescription
    Search Type*Specify a type of search:
    • parameter—retrieves the search terms entered by the user from the URL query string. Specify the name of the query string parameter in which you pass search terms in the Query string parameter attribute.
    • referrer—uses the search terms entered in a search engine to search for content items. By default, SmartTarget provides support for Google, Bing, Yahoo and Altavista search engines. You can configure support for other search engines in the smarttarget.referrers.xml.
    • keyword—uses the search terms specified in the Web page. To implement a keyword search you need to add code to your published Web pages to pass the search term values to SmartTarget.
    Query string parameter

    When the value of Search Type is parameter, enter the name of the URL parameter from which SmartTarget retrieves the search terms. For example, enter q if the URL is google.com/q=example.

  9. Select the Show SmartTarget Items Template Building Block and define the attributes:
    You can define the following attributes for Show SmartTarget Items:
    AttributeDescription
    Page Region*Specify the region of your Web page where content items relating to search are displayed. The value must correspond with an id value specified in the <tcdl:region> tag of a Dreamweaver Template exactly (Page Region values are case-sensitive).
    Maximum items to display*Specify the maximum number of content items that are allowed to be displayed in the Page Region.
    Header markupDefine a header section for content items returned by a query.
  10. Select Debug > Run to run the template, or Debug > Run with Page if it is the first time you are running the Compound Template (you are prompted to select a Page).