Hi, I'm trying to implement a language selector. In the content node I have two home pages (see screenshot), each assigend a different culture. In the code below, the call CurrentPage.AncestorOrSelf( 1 ).Siblings() doesn't return any elements, so the code inside the foreach loop is never called. Any idea what I am doeing wrong? Much Thanks!
Thank you for your reply!
On Umbraco TV this was done with the Siblings() call (see screenshot), that's why I tried this. Perhaps this worked in a previous version and doensn't work anymore in version 7?
What is the meaning exactly of the integer parameter? Is it the next x-siblings? Whatever value I pass into the Sibling() method call, it allways retuns null?
var homePages = CurrentPage.AncestorOrSelf( 1 ).Sibling(1); // returns null
var homePages = CurrentPage.AncestorOrSelf( 1 ).Sibling(2); // returns null
Siblings doesn't return any elements
Hi, I'm trying to implement a language selector. In the content node I have two home pages (see screenshot), each assigend a different culture. In the code below, the call CurrentPage.AncestorOrSelf( 1 ).Siblings() doesn't return any elements, so the code inside the foreach loop is never called. Any idea what I am doeing wrong? Much Thanks!
Hi Gert,
How about this: If you see the cheat sheet for Razor MVC, I know it´s for version 6, but if you look at it the Sibling() and it taks an int.
http://our.umbraco.org/projects/developer-tools/umbraco-v6-mvc-razor-cheatsheets
Hope this helps,
/Dennis
Hi Dennis,
Thank you for your reply! On Umbraco TV this was done with the Siblings() call (see screenshot), that's why I tried this. Perhaps this worked in a previous version and doensn't work anymore in version 7?
What is the meaning exactly of the integer parameter? Is it the next x-siblings? Whatever value I pass into the Sibling() method call, it allways retuns null?
Any idea what I'm doing wrong?
Much thanks!
Gert.
I resolved the problem by looking for the different home pages based on the document type like this.
Gert.
This worked for me for Umbraco 7.2.0:
And this also:
is working on a reply...