Jump to:

3395 Posts in 977 Topics by 853 members

Template Questions

SilverStripe Forums » Template Questions » access user parameter

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

Page: 1
Go to End
Author Topic: 796 Views
  • hiks
    Avatar
    Community Member
    7 Posts

    access user parameter Link to this post

    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.

    796 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.