<?php
$output = '';
$url = $_SERVER['REQUEST_URI'];
$path = parse_url($url);
$segments = explode('/', $path['path']);
foreach ($segments as $s => $segment) {
if ($s > 0) {
$output .= $modx->setPlaceholder('segment'.$s, $segment);
}
if ($s == count($segments) - 1) {
$output .= $modx->setPlaceholder('segmentLast', $segment);
}
}
return $output;
[[!If? &subject=`[[!urlSegment? &segment=`3`]]` &operator=`EQ` &operand=`section-3a` &then=`code to show when true` &else=`code to show when false` ]]
[[!If? &subject=`[[urlSegment? &segment=`3`]]` &operator=`EQ` &operand=`section-3a` &then=`code to show when true` &else=`code to show when false` ]]
[[UltimateParent:is=`X`:then=`code to show when true`:else=`code when false`? &topLevel=`2`]]

[[!If? &subject=`[[*id]]` &operator=`==` &operand=`7` &then=`my code`]]