Hiya,
Another very very quick plugin made in about a minute so hopefully it works as advertised
This one is for returning the value of a certain URI segment working from the end of the URI backwards.
Usage :
{exp:traverse_segments position="0"}
{segment}
{if '{segment}' == "test"}
YAY
{/if}
{/exp:traverse_segments}
Parameters :
position="0”
This will retrieve the last segment
position="1”
This would retrieve the last but one segment and so on and so forth!
Variables :
{segment}
Returns the value of the requested segment
Possibilities :
{if '{segment}' == "tests"}
<p>Segment was the same!!</p>
{/if}
Disclaimer - Not too sure if the if conditional above is entirely the correct way to do things. I mean with the ‘{segment}’ part. I think there is probably a better way to do this but it should work as is. Spitting out the {segment} variable should work without any problems though.
If the segment you had requested was in this case equal to tests then the message would be returned
Hope this is of some use to people. Hopefully it will work correctly on all systems too because as I said this was created very very quickly
Best wishes,
Mark
