ASPX templates
Version 6.x > ASPX templates > Transformation for CMS Repeater returning wrong culture URL View modes: 
User avatar
Member
Member
Greg Hardin - 4/26/2012 4:14:32 PM
   
Transformation for CMS Repeater returning wrong culture URL
I'm using a CMSRepeater Control to build my blog post list page.

When I'm in the second language version I load a different transformation and set the CultureCode on the CMSRepeater to the right culuture code.

This is the transformation for the second language:

<div class="blogPost">
<h2>
<a href="<%# GetDocumentUrl() %>"><%# Eval("BlogPostTitle", true) %></a>
</h2>
<div class="blogCategories">
Categorías: <%# Eval("DocumentTags", true) %>
</div>

<%# IfEmpty(Eval("BlogPostTeaser"), "", "<div class=\"blogImage\"><img alt=\"" + Eval("BlogPostTitle") + "\" src=\"" + GetFileUrl("BlogPostTeaser") + "\" /></div>") %>
<div class="BlogPBody TextContent">
<%# Eval("BlogPostSummary") %> ... <a href="<%# GetDocumentUrl() %>">MAS</a>
</div>
<div class="floatRight">
<span class='st_facebook_large' displayText='Facebook' st_url="<%# Request.Url.Scheme + "://" + Request.Url.Host + GetDocumentUrl() %>"></span>
<span class='st_twitter_large' displayText='Tweet' st_url="<%# Request.Url.Scheme + "://" + Request.Url.Host + GetDocumentUrl() %>"></span>
<span class='st_googleplus_large' displayText='Google +' st_url="<%# Request.Url.Scheme + "://" + Request.Url.Host + GetDocumentUrl() %>"></span>
</div>
<div class="clearfix"></div>
</div>


It is being used properly and the repeater is pulling only the documents in this culture, but GetDocumentURL() inside of it is giving me the wrong culture's URL to the posts.

for example it's giving me

http://hostname/the-blog/april-2012/blog-post

rather than

http://hostname/el-blog/abril-2012/blog-posto


What do I need to do to fix this? I don't see anything in the documentation on how to force it to the right URL scheme.

User avatar
Kentico Support
Kentico Support
kentico_janh - 4/27/2012 2:38:55 AM
   
RE:Transformation for CMS Repeater returning wrong culture URL
Hello,

Yes, but when you click on that link, you get the right culture version of that document, don't you? Anyway, you don't have to use the GetDocumentURL() method and you can build up that link by yourself and by document's properties like:

<a href="~<%# NodeAliasPath %>">...</a>


Best regards,
Jan Hermann

User avatar
Member
Member
Greg Hardin - 4/27/2012 7:55:00 AM
   
RE:Transformation for CMS Repeater returning wrong culture URL
I actually get the English version of the post when I click that link. I have it set to use the document alias path as the URL for the document.

It seems like a bug that GetDocumentUrl() doesn't respect the culture code passed into the repeater

I'll try using the nodealiaspath and see if that works

User avatar
Kentico Support
Kentico Support
kentico_janh - 4/30/2012 1:41:40 AM
   
RE:Transformation for CMS Repeater returning wrong culture URL
Hello,

The behavior of the GetDocumentURL method is a bit different than I have mentioned before. The GetDocumentURL() method takes a Document alias of a current rendered document and creates a link to this alias (which is same for all culture versions of your document and the content is displayed according to set culture cookie) if the Custom URL path property is not filled for a document. So you can fill a different path for a different culture version of your document and this path will be rendered as a link for this document.

User image

Best regards,
Jan Hermann

User avatar
Member
Member
Greg Hardin - 4/30/2012 7:31:04 AM
   
RE:Transformation for CMS Repeater returning wrong culture URL
User image

as you can see in this screenshot, those fields are both already set to what i'd like them to be.

User avatar
Kentico Support
Kentico Support
kentico_janh - 4/30/2012 7:59:58 AM
   
RE:Transformation for CMS Repeater returning wrong culture URL
Hello,

So where is the problem? Aren't your documents available on that url? All your culture versions of that document should be available on that prefilled url.

Best regards,
Jan Hermann

User avatar
Member
Member
Greg Hardin - 4/30/2012 8:10:48 AM
   
RE:Transformation for CMS Repeater returning wrong culture URL
User image

The english version of this particular document has the alias path that you see in this screenshot.

using GetDocumentURL() in the transformation for the repeater control gives me the ENGLISH URL which leads to the ENGLISH Content rather than the SPANISH url which would lead me to the SPANISH content. The rest of the content that the repeater control returns is valid. It's retreiving the spanish documents and transforming them properly aside from the GetDocumentURL() method.

User avatar
Member
Member
Greg Hardin - 4/30/2012 9:23:52 AM
   
RE:Transformation for CMS Repeater returning wrong culture URL
I've just applied the latest hotfix (6.0.29) and this appears to have fixed this problem for me.