Posted on 26/03/2014 09:53:17
I assume that you're using the Languages loop, and under that assumption you have found a bug with that loop. We'll take a look at that.
It's a bit tricky to get all available languages using Razor, but it can be done like this (using a Razor helper):
@helper DisplayLanguages()
{
// Find the master area
var masterAreaId = Pageview.Area.ID;
if ((int)Pageview.Area.get_Value("AreaMasterAreaId") > 0)
{
masterAreaId = (int)Pageview.Area.get_Value("AreaMasterAreaId");
}
// Get a list of Dynamicweb.Frontend.Area with the master area first and followed by child areas (sorted by AreaSort)
var areas = new SortedDictionary< int, Dynamicweb.Frontend.Area >() { { 0, (Dynamicweb.Frontend.Area)Pageview.AreaCollection[masterAreaId] } };
foreach (System.Collections.DictionaryEntry e in Pageview.AreaCollection)
{
var area = (Dynamicweb.Frontend.Area)e.Value;
if ((int)(area).get_Value("AreaMasterAreaId") == masterAreaId)
{
areas.Add((int)area.get_Value("AreaSort"), area);
}
}
if (areas.Count > 0)
{
<ol class="websites">
@foreach (var e in areas)
{
var area = e.Value;
if (area.ID == Pageview.Area.ID)
{
<li class="current"><a href='/Default.aspx?Id=@area.get_Value("AreaFirstPage")'>@area.get_Value("AreaName") @area.ID</a></li>
}
else
{
<li><a href='/Default.aspx?Id=@area.get_Value("AreaFirstPage")'>@area.get_Value("AreaName") @area.ID</a></li>
}
}
</ol>
}
}
Then you can use this helper anywhere in your template:
<div class="page">
...
@DisplayLanguages()
...
</div>
We have to find an easier way to do this, but for now you can use the stuff shown above.
Best regards,
Mikkel