This section describes how to define a new cartridge and use Workbench to configure it to appear on a page.

To create and configure a basic "Hello, World" cartridge, follow these steps:

  1. Navigate to the templates directory of your application, and create a subdirectory named "HelloWorld." This directory name is the template ID for your template.

    For example: C:\Endeca\apps\Discover\config\cartridge\import\templates\HelloWorld.

  2. Create a cartridge template.

  3. Upload the template to Workbench.

  4. Add the cartridge to a page.

  5. Try to view the cartridge in the Discover Electronics application.

The following shows the JSON representation of the page with most of the tree collapsed, highlighting the data for the cartridge that we just added.

{

    "@type": "ResultsPageSlot",
    "name": "Browse Page",
    "contentCollection": "Search And Navigation Pages",
    "ruleLimit": "1",
    "contents": [
        {
            "@type": "ThreeColumnNavigationPage",
            "name": "Default Page",
            "title": "Discover Electronics",
            "metaKeywords": "camera cameras electronics",
            "metaDescription": "Endeca eBusiness reference application.",
            "links": [ ],
            "header": [ … ],
            "leftColumn": [ … ],
            "main": [ … ],
            "rightColumn": [
                { … },
                { … },
                {
                    "@type": "Hello",
                    "name": "Hello cartridge",
                    "message": "Hello, World!",
                    "messageColor": "#FF0000"
                }
            ]
        }
    ],
    …

}

In the next section, we'll create a simple renderer that displays the message based on the values configured in Experience Manager.


Copyright © Legal Notices