Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

access user parameter


Go to End


1637 Views

Avatar
hiks

Community Member, 7 Posts

26 June 2009 at 11:31am

Edited: 26/06/2009 11:32am

Hi again,

I added this to my page.php

	function MyLang() {

		return Translatable::current_lang();
	}
and now I can use <% MyLang or $MyLang in my templates. Don't ask why, I need it in my templates^^
But now, there's a new problem:
<% control LatestPost(2) %><% MyLang ...
MyLang isn't working anymore, I think cause of the <% control %>. But why? MyLang is in Page_Controller in page.php, the template and the control both inherits from Page_Controller (xxx extends Page_Controller). Why is MyLang not available? There's no error, it just seems to be empty, also
return "en" . Translatable::current_lang();
won't return "en".

Other possibility, can I use hierarchies in <% %>? Something like

<% Level(1).MyLang %>  // <<<<< this will throw an error

I've given up now, don't have any idea... Also _t(...) doesn't work, it always retruns default string.