File list for editorials

Vote:
 

I am rather new at episerver started now on the 7.5!


I want editors to easy choose files from a mapp and make link of them

In ver 6 there looks like there is something called dynamic content and file list!

See it in this video

http://www.screenr.com/aKa8

Thats the easy solution I want! Is that solution avaible in  7.5?

I cannot find it!

// Markus

#116257
Jan 27, 2015 12:01
Vote:
 

You can make a block for that and insert it in the text editor (XhtmlString property).

Just one property needed on the block type:

[ContentType]
public class FileListBlock : BlockData
{
    [UIHint(UIHint.MediaFolder)]
    public virtual ContentReference FolderPath { get; set; }
}

Then you can use IContentRepository to get the children (files):

var contentRepo = ServiceLocator.Current.GetInstance<IContentRepository>();

IEnumerable<MediaData> files = contentRepo.GetChildren<MediaData>(myBlockContent.FolderPath);

In your block view you just render <ul> with links to the files:

<ul>
    @foreach (var file in files)
    {
        <li><a href="@Url.ContentUrl(file.ContentLink)">@file.Name</a>
    }
</ul>
#116377
Edited, Jan 29, 2015 11:04
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.