I have the following link:
I know that $smarty.server.REQUEST_URI
will return user/username/about
.
But I can't find a way to return the latest part of my link which is about
.
How can I return it? I prefer a solution that does not require me to alter or add new functions in .php files.
Here's an alternative to Marcin's answer using PHP's basename() function instead of substr/strrpos:
{$smarty.server.REQUEST_URI|basename}
You can use:
{$smarty.server.REQUEST_URI|substr:($smarty.server.REQUEST_URI|strrpos:'/'+1)}
It finds the last /
in this string and return everything after it.
It is working in Smarty 3.1.19