<%@ Control Language="C#" AutoEventWireup="true" CodeFile="template.ascx.cs" Inherits="ComponentTemplate" %>
<%@ Import Namespace="Bitrix" %>
<%@ Import Namespace="Bitrix.IBlock" %>
<%@ Import Namespace="System.Collections.Generic" %>

<%@ Reference Control="~/bitrix/components/bitrix/rss.out/component.ascx"%><?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
    <channel>
        <title><%= (Component.IBlockName + (Component.IBlockSectionName != null ? " / " + Component.IBlockSectionName : "")) %></title>
        <link>http://<%= Component.SiteUrl%><%= Component.SiteDirectory%></link>
        <description><%= (Component.IBlockSectionDescription != null ? Component.IBlockSectionDescription : "") %></description>
        <lastBuildDate><%= DateTime.Now.ToString("r") %></lastBuildDate>
        <ttl><%= Component.Parameters["RssTTL"]%></ttl>
        <%
        if (Component.IBlock!=null && Component.IBlock.Image != null)
        {
        %>
        <image>
	        <title><%= Component.IBlockName %></title>
	        <url>http://<%= Component.SiteUrl%><%= Component.IBlock.Image.FilePath%></url>
	        <link>http://<%= Component.SiteUrl%><%= Component.SiteDirectory%></link>
	        <width><%= Component.IBlock.Image.Width %></width>
	        <height><%= Component.IBlock.Image.Height %></height>
        </image>
        <%} %>
        <%
        foreach (BXTemplateIBlockElement item in Component.Items)
        {
        %>
            <item>
                <title><%= item.Name %></title>
                <link>http://<%= Component.SiteUrl%><%= item.DetailUrl%></link>
                <description><%= item.Description%></description>
                <%if(item.Image != null)
                  { %>
                    <enclosure url="<%= "http://"+Component.SiteUrl%><%=item.Image.FilePath %>" length="<%=item.Image.FileSize %>" type="<%=item.Image.ContentType%>" width="<%=item.Image.Width %>" height="<%=item.Image.Height %>"/>
                <%} %>
                <pubDate><%=item.DisplayDate %></pubDate>
                <%if(Component.IBlockSectionName != null)
                {
                %>
		            <category><%= Component.IBlockSectionName%></category>
	            <%} %>
            </item>
        <%
        }
        %>
    </channel>
</rss>