Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 687 Bytes

item-renderings.md

File metadata and controls

20 lines (16 loc) · 687 Bytes

Item Renderings

In this section we'll show how to manage item renderings.

Example: The following demonstrates the use of Get-Rendering and Set-Rendering for updating values on templates.

$rendering = Get-Item -Path "master:\sitecore\layout\Sublayouts\Sample Sublayout"

$items = Get-ChildItem -Path "master:\sitecore\templates\Sample Item" -Recurse 
foreach($item in $items) {
    $renderingInstance = Get-Rendering -Item $_ -Rendering $rendering 
    if ($renderingInstance) { 
        Set-Rendering -Item $_ -Instance $renderingInstance -Parameter @{ 
            "Lorem" = "Ipsum" 
        } 
        Write-Host "Updated $($_.Paths.FullPath)" 
    } 
}