Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: Creating funtion to list out all PDF's in a media folder

$
0
0
Hi ewebdzinde,

For an XSLT function,
  1. Add a parameter of the type "Data Reference <C1 Media Folder>".
  2. Consider specifying a Test value for this parameter to be able to preview the function's input
  3. On the Function Calls tab, add the function "Composite.Data.Types.IMediaFile.GetIMediaFileXml".
  4. Select needed fields, e.g. ID and Title
  5. In the Filter parameter, select the function "Composite.Data.Types.IMediaFile.MediaFolderFilter"
  6. For its MediaFolder parameter select the Input parameter.
Thus, the function will get the media files from the folder specified in the input parameter.

In the template, make use of the returned files' IDs and Titles and build your list:
<xsl:template match="/">
        <html>
            <head/>
            <body>
                <ul>
                    <xsl:apply-templates select="/in:inputs/in:result[@name='GetIMediaFileXml']/IMediaFile"/>
                </ul>
            </body>
        </html>
    </xsl:template>
        
    <xsl:template match="/in:inputs/in:result[@name='GetIMediaFileXml']/IMediaFile">
        <li>
            <xsl:value-of select="@Title"/><br/>
            <a href="~/media({@Id})">Download</a>
        </li>
    </xsl:template>

Viewing all articles
Browse latest Browse all 2540

Trending Articles