Using echo to display the segment seems to work, but generates an error with my EE installation. You could do something like this and just use PHP without any EE tags. This will return the last URL segment:
<?php
function returnSegmentName($path) {
$start = strrpos($path, '/') + 1;
$length = strlen($path);
$seg = substr($path, $start, $length);
return $seg;
}
$path = $_SERVER['PHP_SELF'];
$seg = returnSegmentName($path);
echo $seg;
?>If your URL is more than three segments, it would need some modification.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.