Hi all,
I'm trying to get the value of a resource string in layout tab in a page template.
My macro syntax {% GetResourceString("MyResourceString") #%}
{% GetResourceString("MyResourceString") #%}
But the result i received was like that. {% GetResourceString("MyResourceString") |(identity)GlobalAdministrator|(hash)381cc48954e7fcfdfaf7163c5274b46ff6100b44b307828bf5d420d24f78582c%}
{% GetResourceString("MyResourceString") |(identity)GlobalAdministrator|(hash)381cc48954e7fcfdfaf7163c5274b46ff6100b44b307828bf5d420d24f78582c%}
I don't understand what happend !
you resources macro syntax is correct. What you see on the screen means that macro is not resolved. Macro syntax does not work in acsx transformation because it is essentially a web control, but you can call c# methods directly :
<%=CMS.Helpers.ResHelper.GetString("resourcestringname")%> <%=CMS.MacroEngine.MacroResolver.Resolve("The current user is: {% CurrentUser.UserName |(identity)GlobalAdministrator%}") %>
Hi, There is ascx layout so you should use .NET syntax
<%#ResHelper.LocalizeString("{$MyResourceString$}") %>
Thanks you for your help Dawid, but when is used this syntax. It just return an empty string.
Did you leave the {$ $} ?
Peter, decide which option is good, because I see right now third version of your answer ;)
It is always the last version :), I just thought it doesn't make any sense to put those strings in the layout It should be a web part in the design tab. Later on to find where this text is coming from would be a nightmare.
Hi guys,
Dawid, I put the $ character at start and the end of the resource string name. But result was empty
Peter, this syntax work for me, thank you. <%=CMS.Helpers.ResHelper.GetString("resourcestringname")%>
<%=CMS.Helpers.ResHelper.GetString("resourcestringname")%>
Please, sign in to be able to submit a new answer.