【问题标题】:How to display file's download link in list?如何在列表中显示文件下载链接?
【发布时间】:2012-10-12 12:17:09
【问题描述】:

我正在使用 FileField 模块。我已经创建了:

  1. 包含文件字段的内容部分“文档列表项”
  2. 一种内容类型“文件项”,其中包含“文档列表项”+通用+标题+可包含
  3. 包含“文件项”的列表

我还通过添加以下内容更改了放置文件:

<Match ContentType="FileItem">
    <Match DisplayType="Summary">
            <Place  Parts_Common_Metadata_Summary="Nowhere"/>
        </Match>
    </Match>

所以现在我看到了标题列表。当我点击标题时,在详细信息页面上有一个下载链接。 但是如何在摘要中显示下载链接?

【问题讨论】:

    标签: orchardcms


    【解决方案1】:

    所以问题解决了:

    我已将 Fields_Contrib_File 添加到展示位置文件:

        <Match ContentType="FileItem">
            <Match DisplayType="Summary">
                    <Place  Parts_Common_Metadata_Summary="Nowhere" Fields_Contrib_File="Content" Parts_Title_Summary="Nowhere"/>
                </Match>
            </Match>
    

    我已从模板文件中删除显示名称 ~/Modules/Contrib.FileField/Views/Fields/Contrib.File.cshtml

    @using Orchard.Utility.Extensions;
    
    @if (!string.IsNullOrWhiteSpace(Model.ContentField.Path)) 
    {
       <p class="file-field">       
          <a href="@Url.Content(Model.ContentField.Path)" target="@Model.Settings.OpenAction">@Model.ContentField.Text</a>
       </p> 
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-28
      • 2018-03-18
      • 1970-01-01
      相关资源
      最近更新 更多