For some reason my code is allowing my version to be displayed as many time as the number of versions under a specific language.
For Example: I have 3 versions of an item under the Chinese Language. The selected version is being displayed now 3 times.
foreach (Sitecore.Globalization.Language language in myitem.Languages)
{
Sitecore.Data.Items.Item languageItem = Sitecore.Context.Database.GetItem(myitem.ID, language, Sitecore.Data.Version.Latest);
foreach (Sitecore.Data.Items.Item version in languageItem.Versions.GetVersions())
{
var thelang = language.ToString().ToLower();
if (thelangauge == "en" || paramamter1 == "" || paramamter1 == null)
{
thelangauge = "en-us";
}
if (thelangauge == paramamter1)
{
if (languageItem.Versions.Count != null)
{
<div class="small-12 columns large-12">
<h1>@Html.Sitecore().Field("Resource Title", languageItem)</h1>
@Html.Sitecore().Field("Description", languageItem)
</div>
}
}
}
}