Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tony Groome 261 posts 804 karma points
    Jun 26, 2015 @ 13:49
    Tony Groome
    0

    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

    enter image description here

  • Mark Bowser 273 posts 860 karma points c-trib
    Jun 26, 2015 @ 16:12
    Mark Bowser
    0

    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?

  • Tony Groome 261 posts 804 karma points
    Jun 29, 2015 @ 12:24
    Tony Groome
    0

    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

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 29, 2015 @ 12:31
    Dennis Aaen
    0

    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

  • Tony Groome 261 posts 804 karma points
    Jun 29, 2015 @ 13:30
    Tony Groome
    0

    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:

    <li><a href="@Umbraco.NiceUrl(1180)">HPC hes</a></li>   
    

    This does nothing. 1180 is the Id for the Forms folder in Media.

    Maybe I should be doing something like:

    @foreach(var form in CurrentPage.AncestorOrSelf(1).Children.Where("DocumentType == \"pdf\""))
    

    {

    }

    I'm not sure how to find the child of Media....

    Thanks. Tony

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 29, 2015 @ 14:52
    Dennis Aaen
    0

    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.

    @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>
        }
    }
    

    Hope this helps,

    /Dennis

  • Tony Groome 261 posts 804 karma points
    Jun 29, 2015 @ 13:03
    Tony Groome
    0

    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:

  • HPC hes
  • where 1118 is the node number of the useful forms folder, but it doesn't. So maybe something like

    @foreach(var form in CurrentPage.AncestorOrSelf(1).Children.Where("DocumentType == \"pdf\"")) {

    }

    This doesn't work though....

    Thanks. Tony

Copy Link
Please Sign in or register to post replies

Write your reply to:

Draft