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\import\templates\HelloWorld.

  2. Create a cartridge template JSON file.

  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.

{
    "workflowState": "ACTIVE",
    "ecr:lastModifiedBy": "admin",
    "ecr:lastModified": "2016-09-12T13:38:32.258+05:30",
    "priority": 100,
    "ecr:createDate": "2016-09-12T13:38:32.258+05:30",
    "ecr:type": "content-item",
    "contentItem": {
        "@name": "Three-Column Page",
        "metaKeywords": "camera cameras electronics",
        "@type": "ThreeColumnPage",
        "title": "Discover Electronics",
        "metaDescription": "Oracle Commerce reference application.",
        "redirectGroup": "",
        "headerContent":{...},
        "leftContent": {...},
        "mainContent": {...},
        "rightContent":[
                { … },
                { … },
                {
                     "@name": "Hello World",
                         "@type": "HelloWorld",
                         "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