I just had this working and now my links have vanished! Now when I press Select no link is saved. I want to display a list of files to download. So under Employee Information there is a folder with some files. This worked the other day and now :(
You mean you had the links to files working in the rich text editor, later when you opened the node in the backoffice, the links were gone? Or you are able to add/edit a link, but when you try to confirm your changes on the dialog box, no link is actually added? Is the problem just on edit? Or is it also on add now?
The first thing I would try is opening up the browser's debugger console to see if you have any javascript errors.
Exactly. I had the links in the content editor and all was well, except for one link was wrong. So I tried to change it and they all disappeared! I think I might create a new document type and template and code them that way. This looks like Gremlins to me!
Yes you could do that, and if the files is in the media library then you could use the media picker, or the multiple media picker to pick the different files.
Ok The plan is to abandon using the Content Editor for the links altogether as it seems to be a bit haywire. So I am going to create a new document type and template to display a list of files which are stored in Media. In Media, I have a folder called Downloads. Under Downloads there are four other folders: Policies, EmployeeInfo, Forms and MotorInfo. In each folder is a list of pdf files for download. I want to display four links on a page to each folder. So I was hoping to do something like:
This post has been a little mess, so this is the only way that I could reply to you.
But what I understand is that you want to choose a folder from the media library and the list all the files of the type PDF in this.
And then list them in the rich text editor. If this is the case, then I think the code below, should do what you are after.
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*
Macro to display a series of images from a media folder.
How it works:
- Confirm the macro parameter has been passed in with a value
- Loop through all the folder Id's passed in (might be a single item, might be many)
- Display any individual files, as well as any folders of files
Macro Parameters To Create, for this macro to work:
Alias:folderId Name:Select folder with files Type:Single Media Picker
*@
@{ var folderId = Model.MacroParameters["folderId"];
var fileExstension = "pdf";
}
@if (folderId != null)
{
@* Get all the media item associated with the id passed in *@
var file = Umbraco.Media(folderId);
var selection = file.Children("File").Where("umbracoExtension == @0",fileExstension);
if (selection.Any())
{
<ul>
@foreach (var item in selection)
{
<li>
<a href="@item.umbracoFile">@item.Name</a>
</li>
}
</ul>
}
}
Happy Monday to you!
The links are back! They came back themselves, must have needed a break over the weekend!! So I will definitely change it. I want to display a link to a folder in the Media library. So for example one folder contains useful forms, so when you click on the useful forms link it will go to the useful forms folder in Media and display the list of pdf forms in the folder.
Link to File
Hi All
I just had this working and now my links have vanished! Now when I press Select no link is saved. I want to display a list of files to download. So under Employee Information there is a folder with some files. This worked the other day and now :(
Any ideas? Thanks. Tony
You mean you had the links to files working in the rich text editor, later when you opened the node in the backoffice, the links were gone? Or you are able to add/edit a link, but when you try to confirm your changes on the dialog box, no link is actually added? Is the problem just on edit? Or is it also on add now?
The first thing I would try is opening up the browser's debugger console to see if you have any javascript errors.
What version of umbraco 7 is it?
Hi Mark
Exactly. I had the links in the content editor and all was well, except for one link was wrong. So I tried to change it and they all disappeared! I think I might create a new document type and template and code them that way. This looks like Gremlins to me!
Thanks. Tony
Hi Tony,
Yes you could do that, and if the files is in the media library then you could use the media picker, or the multiple media picker to pick the different files.
Hope this helps,
/Dennis
Hi Dennis
Something went really wrong there!
Ok The plan is to abandon using the Content Editor for the links altogether as it seems to be a bit haywire. So I am going to create a new document type and template to display a list of files which are stored in Media. In Media, I have a folder called Downloads. Under Downloads there are four other folders: Policies, EmployeeInfo, Forms and MotorInfo. In each folder is a list of pdf files for download. I want to display four links on a page to each folder. So I was hoping to do something like:
This does nothing. 1180 is the Id for the Forms folder in Media.
Maybe I should be doing something like:
{
}
I'm not sure how to find the child of Media....
Thanks. Tony
Hi Tony,
This post has been a little mess, so this is the only way that I could reply to you.
But what I understand is that you want to choose a folder from the media library and the list all the files of the type PDF in this.
And then list them in the rich text editor. If this is the case, then I think the code below, should do what you are after.
Hope this helps,
/Dennis
Hi Dennis
Happy Monday to you! The links are back! They came back themselves, must have needed a break over the weekend!! So I will definitely change it. I want to display a link to a folder in the Media library. So for example one folder contains useful forms, so when you click on the useful forms link it will go to the useful forms folder in Media and display the list of pdf forms in the folder.
I was hoping something like this might work:
@foreach(var form in CurrentPage.AncestorOrSelf(1).Children.Where("DocumentType == \"pdf\"")) {
}
This doesn't work though....
Thanks. Tony
is working on a reply...