How to use slots to relate content?

In Rhythmyx we can use slots to associate related content. The slots can relate content either by system generated using JCR query(Automated Slot) or by user(Manual Slot).

Automated(Auto) Slot: Auto slot is where the slot is configured to retrieve related content from the CMS using JCR query.

Manual Slot: In manual slot content are associated by user adding the related content to the designated slot.

There are other types of slot and details on how to create and use various types of slot can be found in below Rhythmyx help link(see Page 120 and Page 193)

Here is an example on how to use an Automated slot for building steps for instructions as show below screenshot.

The above screenshot shows list of steps involved to pay parking tickets. To associate the steps involved, we can create each step of an instruction as item in a folder and relate them using either Automated slot or Manual slot.

Steps involved:

  1. Create a Step content type,template and slot to related the steps to instructions using slot.
    Step content type (rxdemoStep)

Step template source (rxDemoStep)

#displayfield("displaytitle")
Step
#field("rx:stepNumber")
  • #field("rx:displaytitle")

    #field("stepDescription")
    1. Create a Instruction content type and template to render the instruction
      Instruction content type:

    Instruction template source code()

    Test /* Steps styles */ .steps h1, .steps h2, .steps p, .steps h3, .steps h4 { margin-left: 9rem; padding-left: 0rem; }

    #instruction .steps ol li li {
    margin-left: 8rem;
    padding-left: 0rem;
    }

    #instruction .steps h1 {
    margin-left: 8rem;
    padding-left: 0rem;
    }

    #instruction .steps h4 {
    margin-left: 8rem;
    padding-left: 0rem;
    }

    #instruction .steps ol {
    padding: 0 0 0 0;
    }

    #instruction .steps ol li {
    list-style-type: none;
    position: relative;
    margin-left: 15px;
    }

    #instruction .steps ol ul li {
    list-style-type: disc;
    }

    #instruction .steps ol li {
    margin-left: -1rem;
    /* margin-bottom: 0px; */
    }

    #instruction .steps ol li {
    line-height: 2.3;
    }

    #instruction .step-label {
    position: absolute;
    width: 80px;
    height: 80px;
    font-size: 18px;
    color: #fe6e04;
    font-weight: 400;
    background-color: #fff;
    border-radius: 160px;
    text-align: center;
    line-height: 2.9;
    border: solid 3px #fe6e04;
    }

     <div id="instruction"> 
        
    <div class="steps">
        <h1>#field("rx:stepInstructionName")</h1>
        <ol>
    #slot("autoInstructions" '' '' '' '' "site_path=$site_path")
            ##slot("rxDemoStepsList" '' '' '' '' '')
    
        </ol>
            </div>  
    </div>
    

    The “autoInstructions” slot call in the template source takes $site_path param value which is configured in template bindings. In the bindings tab of the template add $site_path variable with value $user.psoFolders.getParentFolderPath($sys.assemblyItem) as shown in below screenshot.

    1. Create Automated slot(auto Instructions) as shown in below screenshots:

    Automated slot configuration:

    Manual slot configuration:

    Once we the above configurations in place we can use either automated slot or manual slot. For manual slot uncomment this code in the Instructions template: ##slot(“rxDemoStepsList” ‘’ ‘’ ‘’ ‘’ ‘’)

    Automated slot with related content using the query provided in the auto slot configuration. The below listed query will pull all steps created in the path of the assembled item which is Instruction in this example.
    SELECT rx:sys_contentid, rx:sys_folderid FROM rx:rxdemoStep WHERE jcr:path like :site_path ORDER BY rx:stepNumber

    When it comes to manual slot the related items needs to be associated by the user by manually adding the steps to the manual slot associated to the Instructions content type item. Sample manual slot association by user in content explorer.

    4 Likes