Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Homepage with repeater containing files from a other location View modes: 
User avatar
Member
Member
guillaume.marquilly-tv5monde - 8/14/2012 8:58:24 PM
   
Homepage with repeater containing files from a other location

Hi,

Like a lot of informations websites, I would like to design an homepage that contains a repeater to display the last articles.

I created a custom document type, ArticleTV5, with the document type Folder as an available parent in the treeview. Also I created these fields: ArticleTV5ID, Description, Content, Category, Image, ImageCopyright, Contributor

Finally I created a folder tree.

My website looks like below:

Root (masterpage)
----- Articles (folder)
--------------- 08-2012 (folder)
------------------------- article 1 (article2)
------------------------- article 2 (article2)
------------------------- article 3 (article2)
--------------- 09-2012 (folder)
------------------------- article 4 (article2)
------------------------- article 5 (article2)
------ Home (menuitem/webpage)


I can display my articles in the homepage main repeater using this basic transformation:

<table border='1' style="border-collapse:collapse;" width='80%'>
<tr>
<td width="60" valign="top">
<%# IfEmpty(Eval("Image"), "", "<img alt=\"" + Eval("DocumentName",true) + "\" src=\"" + GetFileUrl("Image") + "?maxsidesize=100\" />") %></td>
<td>
<h2><a href="<%# GetDocumentUrl() %>"><%# Eval("DocumentName",true) %></a></h2>
<p><%# IfEmpty(Eval("Description"), Eval("Content"), Eval("Description")) %></p>
</td>
</tr>
</table>

but I encounter some problems with the "selected" transformation (the default transformation for example). It looks like my master page is repeated inside my placeholder as many times as the number of folders' levels and I can't display my whole selected article.

I know that I can put my articles as subelements from my homepage to avoid this issue, but i'm not satisfied because of the displayed UR: hostname/Home/Articles/08-2012/blablabla.asp. I would prefer to have this kind of URL: hostname/Articles/08-2012/blablabla.aspx when im on a selected article.

Is my design possible? What are the different solutions to design something like that?

Thank you,



User avatar
Kentico Support
Kentico Support
kentico_janh - 8/15/2012 2:43:18 AM
   
RE:Homepage with repeater containing files from a other location
Hello,

Your design is absolutely alright and it should work that way. Could you please set the Inherit content property (folder -> Properties -> Template) of your folders to not inherit any content? Could you please also apply the latest hotfix for your Kentico project?

Best regards,
Jan Hermann

User avatar
Member
Member
guillaume.marquilly-tv5monde - 8/15/2012 5:02:00 AM
   
RE:Homepage with repeater containing files from a other location

Hi Jan, thanks for your answer.

I just tried your solution, but the issue is still there. I think that when i click on an article, im redirected to an other "branch" of the treeview without the repeater, because the Url does not contain the homepage. So it can't use any transformations.

Am I right?

PS: I have a very recent version (v6.0.34 SP1)

User avatar
Kentico Support
Kentico Support
kentico_janh - 8/15/2012 6:38:06 AM
   
RE:Homepage with repeater containing files from a other location
Hello,

Yes, that's it. You need to set the same template on your article documents as your Home document has (document -> Properties -> Template) or at least set a template for those articles which contains a repeater with same filled properties as they are on your Home page.

Best regards,
Jan Hermann

User avatar
Member
Member
guillaume.marquilly-tv5monde - 8/16/2012 4:52:14 AM
   
RE:Homepage with repeater containing files from a other location

Hi Jan,

Thank you for your answer.

My home page inherits from an adhoc template (i dont remeber the original version but i think that it was only a layout) and my document types articles inherit from the masterpage right now.

I have to create a specific layout/template with a repeater for these articles so?

Thank you!

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 8/18/2012 4:58:08 PM
   
RE:Homepage with repeater containing files from a other location
Hi,

yes, in case home and articles documents does not share template with repeater you need to create a new template with repeater which will be used on these documents.

1. On your Home document you probably have a repeater which lists articles. In case it is not change its properties to :
Path: /Articles/%
Document types: your doc. type
Transformation: code name of transformation you shared.

Now this web part should correctly generate links to document. If you click on it, you will be redirected to the article page, i.e. the same on as you would click on particular document in the content tree of CMS Desk.

So on this article template you need to add a repeater and set its:

Path: . (dot means current document)
Document types: your doc.type
Transformation: your transformation.

Now you should be able to see article data.

Best regards,
Ivana Tomanickova