Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Is repeater the only way to show document type file? View modes: 
User avatar
Member
Member
steven4733-gmail - 2/1/2012 10:54:21 AM
   
Is repeater the only way to show document type file?
I wonder if repeater is the only web part to display a document type file. The thing is, if I just want to display only one document type file, must I use repeater?

User avatar
Kentico Support
Kentico Support
kentico_janh - 2/1/2012 1:52:07 PM
   
RE:Is repeater the only way to show document type file?
Hello,

If you want to display only one document, you can use any text web part (e.g. static text web part) to render its fields through the context macros.

Best regards,
Jan Hermann

User avatar
Member
Member
steven4733-gmail - 2/1/2012 3:58:18 PM
   
RE:Is repeater the only way to show document type file?
I see there is a "show for document types" property in static text web part, but how to define the transformations if I use static text web part?

User avatar
Kentico Support
Kentico Support
kentico_janh - 2/2/2012 4:09:12 AM
   
RE:Is repeater the only way to show document type file?
Hello,

No, let me explain it to you:

1) Go to the document, which you want to display as a single document on a page

2) Place a static text web part on this document (if you use its template also on other documents, you will need to create an ad-hoc tamplate for it)

3) Open properties of the static text web part and fill the Text field with a combination of a text and custom macros like this:

Document name is {%DocumentName%}


Best regards,
Jan Hermann

User avatar
Member
Member
lwhittemore-emh - 3/15/2012 8:03:00 AM
   
RE:Is repeater the only way to show document type file?
How would I turn this into a widget that would give the user the ability to select what documents data is being used?

User avatar
Kentico Support
Kentico Support
kentico_janh - 3/19/2012 2:45:28 AM
   
RE:Is repeater the only way to show document type file?
Hello,

Could you please describe it in more details? I don't really understand, how such a widget would work.

Best regards,
Jan Hermann

User avatar
Member
Member
lwhittemore-emh - 3/19/2012 6:21:57 AM
   
RE:Is repeater the only way to show document type file?
essentially what I would like to have is a widget for my home page that allows an editor to select the piece of content that that widget displays. I had originally tried a repeater with the path set to editable. but this did not work as it did not pick the selected item from the path.

I have tried other web parts like the universal document selector but I am not really sure how those are intended to work.

To explain once more what I am trying to accomplish in more detail: I would like 2 widgets on my home page that both function the same way. The widgets would only allow the editor to select a signal document each and then would display their content based off a transformation. (the transformation just pull the title, teaser image and summary with a read more link at the bottom)

I can build something similar with a repeater and have it only show one document based on a path, but I cannot get it show a specifically selected document. With the path I am only able to get 1 item based off of the order I set.

I hope this makes more sense.

Thanks
Lawrence

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 3/20/2012 12:32:45 PM
   
RE:Is repeater the only way to show document type file?
The reason it uses a repeater is because it is a templateable control. The Asp.NET Framework does not have a built-in control that is templateable and only shows one item.

When the CMS repeater loads The ascx transformation, it loads it up like a virtual file and casts it as a class that implements the Itemplate interface. This is a very good way to accomplish what they are doing.

In order to do exactly what you are wanting to do, you will likely need to create a custom web part and add a field to select 1 document then make it so that field will change the value of the where clause used in the CMS repeater.

Writing your own custom web part that uses the same settings as the document repeater web part, but doesn't use the cms repeater (for when you basically want the settings so you can choose what data to get and do anything you want with the result). You will need to study how it is done in the repeater web part and possibly use Reflector to see what methods and things you will need. I have done it before and it was just tedious.


Now, about the "Selected Item" of the repeater. If you are putting these widgets on any document that is not the document you want to be displayed in the widget, then it won't work the way you want. The "Selected Item" is always the document who's document alias matches the current url.

Instead of using the Selected Item transformation, concentrate on making your query return only the one document and use the Item and Alternating Item transformations.

I hope all of this makes sense because it is difficult for me to explain.

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 3/24/2012 10:31:12 AM
   
RE:Is repeater the only way to show document type file?
Hi,

the easiest solution is really use a repeater web part. Unfortunately, there was a bug a widget based on repeater was not displayed. I tested behavior on hotfix 21 and it works correctly.

I create a new widget based on the repeater web part. Then in field of widget I set ClassNames property/field to cms.article so repeater by default selected coupled data. TransformationName field was set to cms.article.default. The only field where I checked the option Display attribute in the editing form was the Path property. Finally, I set Security tab to be able to add the widget.

After I added it on the page I could select the Path using selector. This control adds by default /% at the end of the path. In your case - if you need to render only one article remove these two characters.

As a result selected article was displayed by the widget

I hope the description makes sense.

Best regards,
Ivana Tomanickova