yurikleban
Mentor
Joined 11 years ago
Joined 11 years ago
yurikleban - You must be trying the component in the logged out state, i.e. if you run this API, you'll get rank name as N/A
/restapi/vc/users/id/-1/ranking/name
Try this code and it should work fine.
<#attempt>
<#if !user.anonymous> <!-- Only triggers when the user is logged in -->
<#assign rank = restadmin("/users/id/${user.id}/ranking/name").value>
Rank - ${rank}
</#if>
<#recover>
<!-- Something went wrong -->
</#attempt>The page object doesn't support that. Instead, use the http.request context object which does have a url method. Using that along with the Freemarker contains built-in can do what you want. For example:
<#if http.request.url?contains("/t5/path/to/page1") || http.request.url?contains("/t5/path/to/page2")>
<code for special pages here>
</#if>