3214 Posts in 848 Topics by 810 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 819 Views |
-
Multilanguage Level1 Template Problem...

27 May 2010 at 9:16am
Hello everyone.
I'm new to SilverStripe. For some days now, i'm trying to solve a multilanguage issue in my templates.
Let me explain:
I'm using for all my Level1 Pages the same template. In this template i have something like a header image which should be the same in its particular section. I did this with the "Level(1).URLSegment" and it worked great in one language! But as soon I change the language the URL changes aswell and my image src breaks.What I need is a function which returns the Level1 URLSegment of my default Language. Which would be "en_US" in my case.
So for example: There is a "service" Section in which are pages like Contact, Imprint, Sitemap and so on. The function should return always "service" in this section regardless of the current selected Language. I need the “MasterTranslationID”, or better: the URLSegment of the MasterPage.I have rudimentary knowledge of PHP and OOP and I think the solution is somewhere around "Translatable::getTranslationGroupID" function. But i lack the deeper insight to connect all this into a working function. :S
I hope you understand my english and - more important: my problem
Thanks in advance.
You people here are doing an incredible job, i learned so much from this forum already =)cheers,
Alex -
Re: Multilanguage Level1 Template Problem...

28 May 2010 at 6:20am
Hey folks,
i finally managed to solve this specific problem
public function getEnglishMasterPage(){
$mypage = DataObject::get_by_id('SiteTree', Translatable::getTranslationGroup());
if($this->URLSegment != 'Security'){
return $mypage->Level(1)->URLSegment;
}else{
return 'service';
}
}
The if statement is in there because without the site breaks when accessing the login page. Not sure why though.
| 819 Views | ||
|
Page:
1
|
Go to Top |
