Фотогалерея на одной странице

#
Re: Фотогалерея на одной странице

<?
                  /* Вывод информационных систем */
                  $InformationSystem = & singleton('InformationSystem');

                  $external_propertys=array();
                  $external_propertys['ОтображатьСсылкуНаАрхив']=1;
                  $external_propertys['ОтображатьСсылкиНаСледующиеСтраницы']=0;

                  /* Количество выводимых элементов */
                  $item_count = 1;

                  $InformationSystemId = 1;

                  $InformationGroupId = 0;  // false - из всех групп, 0 - из корневой группы

                  $InformationSystem->ShowInformationSystem($InformationSystemId, $InformationGroupId,'СписокЭлементовИнфосистемы',$item_count,0,$external_propertys);
                  ?>
                  
                  
                  
                  
                  <?xml version="1.0" encoding="windows-1251"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" encoding="Windows-1251" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml"/>
   
   <xsl:template match="/">
      
      <xsl:apply-templates select="/document"/>
      
   </xsl:template>
   
   
   <xsl:template match="/document">
      <script>
         <xsl:comment>
            <xsl:text disable-output-escaping="yes">
               <![CDATA[
               function ShowImgWindow(title, src, width, height)
               {
               obj = window.open("", "", "scrollbars=0,dialog=0,minimizable=1,modal=1,width="+width+",height="+height+",resizable=0");
               obj.document.write("<html>");
                  obj.document.write("<head>");
                     
                  obj.document.write("<title>"+title+"</title>");
                     
                  obj.document.write("</head>");
                  
                  obj.document.write("<body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>");
                     
                     obj.document.write("<img src=\""+src+"\" />");
                     
                  obj.document.write("</body>");
               obj.document.write("</html>");
               }
               ]]>
            </xsl:text>
         </xsl:comment>
      </script>
      
      
      <!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
      <xsl:variable name="parent_group_id" select="blocks/parent_group_id"/>
      
      <!-- Если в находимся корне - выводим название информационной системы -->
      <xsl:if test="blocks/parent_group_id = 0">
         
         <!-- Описание выводится при отсутствии фильтрации по тэгам -->
         <xsl:if test="count(blocks/tags/tag) = 0">
            <xsl:value-of disable-output-escaping="yes" select="blocks/description"/>
         </xsl:if>
      </xsl:if>
      
      <!-- Если в находимся в группе - выводим название группы -->
      <xsl:if test="blocks/parent_group_id != 0">
         
         <!-- Описание выводим только на первой странице -->
         <xsl:if test="blocks/items/current_page = 0">
            <xsl:value-of disable-output-escaping="yes" select=".//group[@id=$parent_group_id]/description"/><br/><br/>
         </xsl:if>
         
         <!-- Путь к группе -->
         <!--
         <p>
            <xsl:apply-templates select=".//group[@id=$parent_group_id]" mode="goup_path"/>
         </p>
         -->
      </xsl:if>
      
      
      <!-- Отображение подгрупп данной группы, только если подгруппы есть и не идет фильтра по меткам -->
      <xsl:if test="count(blocks/selected_tags/tag) = 0 and count(.//group[@parent_id=$parent_group_id]) &gt; 0">
         <xsl:apply-templates select=".//group[@parent_id=$parent_group_id]" mode="groups"/>
      </xsl:if>
      
      
      <xsl:if test="count(//blocks/items/item[item_status=1 and @group_id=$group_id]) > 0">
         <!-- Число элементов в строку -->
         <xsl:variable name="items_in_line" select="4"/>
         <xsl:call-template name="items">
            <xsl:with-param name="items_in_line" select="$items_in_line"/>
            <xsl:with-param name="current_position" select="0"/>
            <xsl:with-param name="item_group" select="$group_id"/>
         </xsl:call-template>
      </xsl:if>
      
      <!-- Строка ссылок на другие страницы информационной системы -->
      <xsl:if test="ОтображатьСсылкиНаСледующиеСтраницы=1">
         <p>
            <!-- Ссылка, для которой дописываются суффиксы page-XX/ -->
            <xsl:variable name="link">
               <xsl:value-of select="/document/blocks/url"/>
               <xsl:if test="$parent_group_id != 0">
                  <xsl:value-of select="/document/blocks//group[@id = $parent_group_id]/fullpath"/>
               </xsl:if>
            </xsl:variable>
            
            <xsl:call-template name="for">
               <xsl:with-param name="link" select="$link"/>
               <xsl:with-param name="items_on_page" select="blocks/items/items_on_page"/>
               <xsl:with-param name="current_page" select="blocks/items/current_page"/>
               <xsl:with-param name="count_items" select="blocks/items/count_items"/>
               <xsl:with-param name="visible_pages">5</xsl:with-param>
            </xsl:call-template>
         </p>
      </xsl:if>
      
      <div style="clear: both"></div>
      
      <xsl:if test="ОтображатьСсылкуНаАрхив=1">
         <div class="archives_4_ie"></div>
         <a href="{blocks/url}">
            <img src="/images/archives.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px"/>
         </a>
         <a href="{blocks/url}">Архив "<xsl:value-of disable-output-escaping="yes" select="blocks/name"/>"</a>
      </xsl:if>
   </xsl:template>
   
   <!-- Шаблон выводит рекурсивно ссылки на группы инф. элемента -->
   <xsl:template match="group" mode="goup_path">
      <xsl:variable name="parent_id" select="@parent_id"/>
      
      <xsl:apply-templates select="//group[@id=$parent_id]" mode="goup_path"/>
      
      <xsl:if test="@parent_id=0">
         <a href="{/document/blocks/url}">
            <xsl:value-of disable-output-escaping="yes" select="/document/blocks/name"/>
         </a>
      </xsl:if>
      
      <span class="path_arrow">&#x2192;</span>
      
      <a href="{/document/blocks/url}{fullpath}">
         <xsl:value-of disable-output-escaping="yes" select="name"/>
      </a>
   </xsl:template>
   
   <!-- Шаблон выводит ссылки подгруппы информационного элемента -->
   <xsl:template match="group" mode="groups">
      
      <table width="100%"><tr><td width="25%" align="center" valign="top">
               
               <xsl:if test="small_image!=''">
                  <a href="{/document/blocks/url}{fullpath}">
                     <img src="{small_image}" /></a>
               </xsl:if>
            </td> <td  valign="top">
               <div class="pp"><a href="{/document/blocks/url}{fullpath}"><xsl:value-of disable-output-escaping="yes" select="name"/></a><br/>
                  <xsl:value-of disable-output-escaping="yes" select="description"/><br/>   <br/>
            Всего фото -&#xA0;<span style="color: #b7af9c"><xsl:value-of select="count_all_items"/></span></div>
      </td></tr></table><hr size="1" width="100%" style="color: #C9FF56;" />
      
      <xsl:if test="count(//blocks/items/item[item_status=1 and @group_id=$group_id]) > 0">
         <!-- Число элементов в строку -->
         <xsl:variable name="items_in_line" select="4"/>
         <xsl:call-template name="items">
            <xsl:with-param name="items_in_line" select="$items_in_line"/>
            <xsl:with-param name="current_position" select="0"/>
            <xsl:with-param name="item_group" select="$group_id"/>
         </xsl:call-template>
      </xsl:if>
      
      
   </xsl:template>
   
   <xsl:template name="items">
      <xsl:param name="items_in_line"/>
      <xsl:param name="current_position"/>
      <xsl:param name="item_group"/>
      <table border="0" cellspacing="0" cellpadding="0" style="margin-bottom: 10px;" width="100%">
         
         <tr>
            <xsl:for-each select="//blocks/items/item[item_status=1 and @group_id=$item_group]">
               <xsl:if test="position() > $current_position and ($current_position + $items_in_line) >= position()">
                  <td style="padding: 0px 5px 0px 5px;" width="25%" align="center">
                     <xsl:if test="item_small_image!=''">
                        <!-- Проверяем задан ли путь к файлу большого изображения -->
                        <xsl:if test="item_image!=''">
                           <a href="{item_image}" target="_blank" onclick="ShowImgWindow('{item_name}','{item_image}', {item_image/@width}, {item_image/@height}); return false;">
                              <img src="{item_small_image}" style="border: 1px solid #c6bea7; padding: 1px;"/>
                           </a>
                        </xsl:if>
                        
                        <xsl:if test="item_image =''">
                           <img src="{item_small_image}" style="border: 1px solid #c6bea7; padding: 1px;"/>
                        </xsl:if>
                     </xsl:if>
                  </td>
               </xsl:if>
            </xsl:for-each>
         </tr>
         
         <tr>
            <xsl:for-each select="//blocks/items/item[item_status=1 and @group_id=$item_group]">
               <xsl:if test="position() > $current_position and ($current_position + $items_in_line) >= position()">
                  <td style="padding: 5px 0px 0px 5px;">
                     
                     
                     <xsl:if test="count(site_user) &gt; 0">
                        <p>
                           <img src="/hostcmsfiles/images/user.gif" style="margin: 0px 5px -4px 0px"/>
                           <strong>
                              <a href="/users/info/{site_user/site_user_login}/" class="c_u_l">
                                 <xsl:value-of select="site_user/site_user_login"/>
                              </a>
                           </strong>
                           <xsl:if test="count(item_comments/comment) &gt; 0">,
                              <img src="/hostcmsfiles/images/comments.gif" style="margin: 0px 5px -4px 0px"/>
                              <a href="{item_path}#comments">
                                 <xsl:value-of select="count(item_comments//comment)"/>&#xA0;<xsl:call-template name="declension">
                                 <xsl:with-param name="number" select="count(item_comments//comment)"/></xsl:call-template></a>
                           </xsl:if>
                        </p>
                     </xsl:if>
                  </td>
               </xsl:if>
            </xsl:for-each>
         </tr>
      </table>
      <xsl:if test="count(//blocks/items/item[item_status=1 and @group_id=$item_group]) > ($current_position + $items_in_line)">
         <xsl:call-template name="items">
            <xsl:with-param name="items_in_line" select="$items_in_line"/>
            <xsl:with-param name="current_position" select="$current_position + $items_in_line"/>
            <xsl:with-param name="item_group" select="$group_id"/>
         </xsl:call-template>
      </xsl:if>
   </xsl:template>
   
   <!-- /// Метки для информационного элемента /// -->
   <xsl:template match="tags/tag">
      <a href="{/document/blocks/url}tag/{tag_path_name}/" class="tag">
         <xsl:value-of select="tag_name"/>
      </a>
   <xsl:if test="position() != last()">,</xsl:if>&#xA0;</xsl:template>
   
   <!-- Цикл для вывода строк ссылок -->
   <xsl:template name="for">
      <xsl:param name="i" select="0"/>
      <xsl:param name="prefix">page</xsl:param>
      <xsl:param name="link"/>
      <xsl:param name="items_on_page"/>
      <xsl:param name="current_page"/>
      <xsl:param name="count_items"/>
      <xsl:param name="visible_pages"/>
      
      <xsl:variable name="n" select="$count_items div $items_on_page"/>
      
      <!-- Заносим в переменную $parent_group_id идентификатор текущей группы -->
      <xsl:variable name="parent_group_id" select="/document/blocks/parent_group_id"/>
      
      
      <!-- Считаем количество выводимых ссылок перед текущим элементом -->
      <xsl:variable name="pre_count_page">
         <xsl:choose>
            <xsl:when test="$current_page &gt; ($n - (round($visible_pages div 2) - 1))">
               <xsl:value-of select="$visible_pages - ($n - $current_page)"/>
            </xsl:when>
            <xsl:otherwise>
               <xsl:value-of select="round($visible_pages div 2) - 1"/>
            </xsl:otherwise>
         </xsl:choose>
      </xsl:variable>
      
      <!-- Считаем количество выводимых ссылок после текущего элемента -->
      <xsl:variable name="post_count_page">
         <xsl:choose>
            <xsl:when test="0 &gt; $current_page - (round($visible_pages div 2) - 1)">
               <xsl:value-of select="$visible_pages - $current_page - 1"/>
            </xsl:when>
            <xsl:otherwise>
               <xsl:choose>
                  <xsl:when test="round($visible_pages div 2) = ($visible_pages div 2)">
                     <xsl:value-of select="$visible_pages div 2"/>
                  </xsl:when>
                  <xsl:otherwise>
                     <xsl:value-of select="round($visible_pages div 2) - 1"/>
                  </xsl:otherwise>
               </xsl:choose>
            </xsl:otherwise>
         </xsl:choose>
      </xsl:variable>
      
      <xsl:if test="$i = 0 and $current_page != 0">
         <span class="ctrl">&#x2190;
         Ctrl</span>
      </xsl:if>
      
      <xsl:if test="$i &gt;= $n and ($n - 1) &gt; $current_page">
         <span class="ctrl">Ctrl &#x2192;</span>
      </xsl:if>
      
      <xsl:if test="$count_items &gt; $items_on_page and $n &gt; $i">
         
         <!-- Определяем адрес тэга -->
         <xsl:variable name="tag_link">
            <xsl:choose>
               <!-- Если не нулевой уровень -->
               <xsl:when test="count(/document/blocks/selected_tags/tag) != 0">tag/<xsl:value-of select="/document/blocks/selected_tags/tag/tag_path_name"/>/</xsl:when>
               <!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
               <xsl:otherwise></xsl:otherwise>
            </xsl:choose>
         </xsl:variable>
         
         <!-- Определяем адрес ссылки -->
         <xsl:variable name="number_link">
            <xsl:choose>
               <!-- Если не нулевой уровень -->
               <xsl:when test="$i != 0">
                  <xsl:value-of select="$prefix"/>-<xsl:value-of select="$i + 1"/>/</xsl:when>
               <!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
               <xsl:otherwise></xsl:otherwise>
            </xsl:choose>
         </xsl:variable>
         
         <!-- Ставим ссылку на страницу-->
         <xsl:if test="$i != $current_page">
            <!-- Выводим ссылку на первую страницу -->
            <xsl:if test="$current_page - $pre_count_page &gt; 0 and $i = 0">
               <a href="{$link}" class="page_link" style="text-decoration: none;">&#x2190;</a>
            </xsl:if>
            
            <xsl:choose>
               <xsl:when test="$i &gt;= ($current_page - $pre_count_page) and ($current_page + $post_count_page) &gt;= $i">
                  <!-- Выводим ссылки на видимые страницы -->
                  <a href="{$link}{$tag_link}{$number_link}" class="page_link">
                     <xsl:value-of select="$i + 1"/>
                  </a>
               </xsl:when>
               <xsl:otherwise></xsl:otherwise>
            </xsl:choose>
            
            <!-- Выводим ссылку на последнюю страницу -->
            <xsl:if test="$i+1 &gt;= $n and $n &gt; ($current_page + 1 + $post_count_page)">
               <xsl:choose>
                  <xsl:when test="$n &gt; round($n)">
                     <!-- Выводим ссылку на последнюю страницу -->
                     <a href="{$link}{$prefix}-{round($n+1)}/" class="page_link" style="text-decoration: none;">&#x2192;</a>
                  </xsl:when>
                  <xsl:otherwise>
                     <a href="{$link}{$prefix}-{round($n)}/" class="page_link" style="text-decoration: none;">&#x2192;</a>
                  </xsl:otherwise>
               </xsl:choose>
            </xsl:if>
         </xsl:if>
         
         <!-- Ссылка на предыдущую страницу для Ctrl + влево -->
         <xsl:if test="$current_page != 0 and $i = $current_page">
            <xsl:variable name="prev_number_link">
               <xsl:choose>
                  <!-- Если не нулевой уровень -->
                  <xsl:when test="($current_page - 1) != 0">page-<xsl:value-of select="$i"/>/</xsl:when>
                  <!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
                  <xsl:otherwise></xsl:otherwise>
               </xsl:choose>
            </xsl:variable>
            
            <a href="{$link}{$tag_link}{$prev_number_link}" id="id_prev"></a>
         </xsl:if>
         
         <!-- Ссылка на следующую страницу для Ctrl + вправо -->
         <xsl:if test="($n - 1) &gt; $current_page and $i = $current_page">
            <a href="{$link}{$tag_link}page-{$current_page+2}/" id="id_next"></a>
         </xsl:if>
         
         <!-- Не ставим ссылку на страницу-->
         <xsl:if test="$i = $current_page">
            <span class="current">
               <xsl:value-of select="$i+1"/>
            </span>
         </xsl:if>
         
         <!-- Рекурсивный вызов шаблона. НЕОБХОДИМО ПЕРЕДАВАТЬ ВСЕ НЕОБХОДИМЫЕ ПАРАМЕТРЫ! -->
         <xsl:call-template name="for">
            <xsl:with-param name="i" select="$i + 1"/>
            <xsl:with-param name="prefix" select="$prefix"/>
            <xsl:with-param name="link" select="$link"/>
            <xsl:with-param name="items_on_page" select="$items_on_page"/>
            <xsl:with-param name="current_page" select="$current_page"/>
            <xsl:with-param name="count_items" select="$count_items"/>
            <xsl:with-param name="visible_pages" select="$visible_pages"/>
         </xsl:call-template>
      </xsl:if>
   </xsl:template>
   
   <!-- Склонение после числительных -->
   <xsl:template name="declension">
      
      <xsl:param name="number" select="number"/>
      
      <!-- Именительный падеж -->
      <xsl:variable name="nominative">
         <xsl:text>комментарий</xsl:text>
      </xsl:variable>
      
      <!-- Родительный падеж, единственное число -->
      <xsl:variable name="genitive_singular">
         <xsl:text>комментария</xsl:text>
      </xsl:variable>
      
      
      <xsl:variable name="genitive_plural">
         <xsl:text>комментариев</xsl:text>
      </xsl:variable>
      
      <xsl:variable name="last_digit">
         <xsl:value-of select="$number mod 10"/>
      </xsl:variable>
      
      <xsl:variable name="last_two_digits">
         <xsl:value-of select="$number mod 100"/>
      </xsl:variable>
      
      <xsl:choose>
         <xsl:when test="$last_digit = 1 and $last_two_digits != 11">
            <xsl:value-of select="$nominative"/>
         </xsl:when>
         <xsl:when test="$last_digit = 2 and $last_two_digits != 12    or $last_digit = 3 and $last_two_digits != 13    or $last_digit = 4 and $last_two_digits != 14">
            <xsl:value-of select="$genitive_singular"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:value-of select="$genitive_plural"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>
</xsl:stylesheet>
#
Re: Фотогалерея на одной странице
ну все... вроде как заработало

<?
                  /* Вывод информационных систем */
                  $InformationSystem = & singleton('InformationSystem');

                  $external_propertys=array();
                  $external_propertys['ОтображатьСсылкуНаАрхив']=0;
                  $external_propertys['ОтображатьСсылкиНаСледующиеСтраницы']=0;

                  /* Количество выводимых элементов */
                  $item_count = 1000;

                  $InformationSystemId = 4;

                  $InformationGroupId = false;  // false - из всех групп, 0 - из корневой группы

                  $InformationSystem->ShowInformationSystem($InformationSystemId, $InformationGroupId,'СписокКартинок1',$item_count,0,$external_propertys);
                  ?>



<?xml version="1.0" encoding="windows-1251"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" encoding="Windows-1251" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml"/>
   
   <xsl:template match="/">
      
      <xsl:apply-templates select="/document"/>
      
   </xsl:template>
   
   
   <xsl:template match="/document">
      <script>
         <xsl:comment>
            <xsl:text disable-output-escaping="yes">
               <![CDATA[
               function ShowImgWindow(title, src, width, height)
               {
               obj = window.open("", "", "scrollbars=0,dialog=0,minimizable=1,modal=1,width="+width+",height="+height+",resizable=0");
               obj.document.write("<html>");
                  obj.document.write("<head>");
                     
                  obj.document.write("<title>"+title+"</title>");
                     
                  obj.document.write("</head>");
                  
                  obj.document.write("<body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>");
                     
                     obj.document.write("<img src=\""+src+"\" />");
                     
                  obj.document.write("</body>");
               obj.document.write("</html>");
               }
               ]]>
            </xsl:text>
         </xsl:comment>
      </script>
      
      
      <!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
      <xsl:variable name="parent_group_id" select="blocks/parent_group_id"/>
      
      <!-- Если в находимся корне - выводим название информационной системы -->
      <xsl:if test="blocks/parent_group_id = 0">
         
         <!-- Описание выводится при отсутствии фильтрации по тэгам -->
         <xsl:if test="count(blocks/tags/tag) = 0">
            <xsl:value-of disable-output-escaping="yes" select="blocks/description"/>
         </xsl:if>
      </xsl:if>
      
      <!-- Если в находимся в группе - выводим название группы -->
      <xsl:if test="blocks/parent_group_id != 0">
         
         <!-- Описание выводим только на первой странице -->
         <xsl:if test="blocks/items/current_page = 0">
            <xsl:value-of disable-output-escaping="yes" select=".//group[@id=$parent_group_id]/description"/><br/><br/>
         </xsl:if>
         
         <!-- Путь к группе -->
         <!--
         <p>
            <xsl:apply-templates select=".//group[@id=$parent_group_id]" mode="goup_path"/>
         </p>
         -->
      </xsl:if>
      
      
      <!-- Отображение подгрупп данной группы, только если подгруппы есть и не идет фильтра по меткам -->
      <xsl:if test="count(blocks/selected_tags/tag) = 0 and count(.//group[@parent_id=$parent_group_id]) &gt; 0">
         <xsl:apply-templates select=".//group[@parent_id=$parent_group_id]" mode="groups"/>
      </xsl:if>
      
      
      
      
      <!-- Строка ссылок на другие страницы информационной системы -->
      <xsl:if test="ОтображатьСсылкиНаСледующиеСтраницы=1">
         <p>
            <!-- Ссылка, для которой дописываются суффиксы page-XX/ -->
            <xsl:variable name="link">
               <xsl:value-of select="/document/blocks/url"/>
               <xsl:if test="$parent_group_id != 0">
                  <xsl:value-of select="/document/blocks//group[@id = $parent_group_id]/fullpath"/>
               </xsl:if>
            </xsl:variable>
            
            <xsl:call-template name="for">
               <xsl:with-param name="link" select="$link"/>
               <xsl:with-param name="items_on_page" select="blocks/items/items_on_page"/>
               <xsl:with-param name="current_page" select="blocks/items/current_page"/>
               <xsl:with-param name="count_items" select="blocks/items/count_items"/>
               <xsl:with-param name="visible_pages">5</xsl:with-param>
            </xsl:call-template>
         </p>
      </xsl:if>
      
      <div style="clear: both"></div>
      
      <xsl:if test="ОтображатьСсылкуНаАрхив=1">
         <div class="archives_4_ie"></div>
         <a href="{blocks/url}">
            <img src="/images/archives.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px"/>
         </a>
         <a href="{blocks/url}">Архив "<xsl:value-of disable-output-escaping="yes" select="blocks/name"/>"</a>
      </xsl:if>
   </xsl:template>
   
   <!-- Шаблон выводит рекурсивно ссылки на группы инф. элемента -->
   <xsl:template match="group" mode="goup_path">
      <xsl:variable name="parent_id" select="@parent_id"/>
      
      <xsl:apply-templates select="//group[@id=$parent_id]" mode="goup_path"/>
      
      <xsl:if test="@parent_id=0">
         <a href="{/document/blocks/url}">
            <xsl:value-of disable-output-escaping="yes" select="/document/blocks/name"/>
         </a>
      </xsl:if>
      
      <span class="path_arrow">&#x2192;</span>
      
      <a href="{/document/blocks/url}{fullpath}">
         <xsl:value-of disable-output-escaping="yes" select="name"/>
      </a>
   </xsl:template>
   
   <!-- Шаблон выводит ссылки подгруппы информационного элемента -->
   <xsl:template match="group" mode="groups">
      <xsl:variable name="group_id" select="@id"/>
      <xsl:param name="item_group"/>
      
      <table width="100%"><tr><td width="25%" align="center" valign="top">
               
               <xsl:if test="small_image!=''">
                  <a href="{/document/blocks/url}{fullpath}">
                     <img src="{small_image}" style="border: 1px solid #c6bea7; padding: 1px;"/></a>
               </xsl:if>
            </td> <td  valign="top">
               <div class="pp"><a href="{/document/blocks/url}{fullpath}"><xsl:value-of disable-output-escaping="yes" select="name"/></a><br/>
                  <xsl:value-of disable-output-escaping="yes" select="description"/><br/><br/>   </div><br/>
         </td></tr>
         
         <tr ><td colspan="2">
               
               <xsl:if test="count(//blocks/items/item[item_status=1]) > 0">
                  <!-- Число элементов в строку -->
                  <xsl:variable name="items_in_line" select="4"/>
                  
                  <xsl:call-template name="items">
                     <xsl:with-param name="items_in_line" select="$items_in_line"/>
                     <xsl:with-param name="current_position" select="0"/>
                     <xsl:with-param name="item_group" select="$group_id"/>
                  </xsl:call-template>
               </xsl:if>
               
               
         </td></tr>
         
      </table><hr size="1" width="100%" style="color: #C9FF56;" /><br/>
      
   </xsl:template>
   
   <xsl:template name="items">
      <xsl:param name="items_in_line"/>
      <xsl:param name="current_position"/>
      <xsl:param name="item_group"/>

      <table border="0" cellspacing="0" cellpadding="0" style="margin-bottom: 10px;" width="100%">
         
         <tr>
      
            <xsl:for-each select="//blocks/items/item[item_status=1 and @group_id=$item_group]">
               <!-- <xsl:if test="position() > $current_position and ($current_position + $items_in_line) >= position()"> -->
                                                 <td style="padding: 0px 5px 0px 5px;" width="25%" align="center">
                                                                <xsl:if test="item_small_image!=''">
                        <!-- Проверяем задан ли путь к файлу большого изображения -->
                        <xsl:if test="item_image!=''">
                           <a href="{item_image}" target="_blank" onclick="ShowImgWindow('{item_name}','{item_image}', {item_image/@width}, {item_image/@height}); return false;">
                              <img src="{item_small_image}" style="border: 1px solid #c6bea7; padding: 1px;"/>
                           </a>
                        </xsl:if>
                        
                        <xsl:if test="item_image =''">
                           <img src="{item_small_image}" style="border: 1px solid #c6bea7; padding: 1px;"/>
                        </xsl:if>
                             </xsl:if>
                                              <br/><br/></td>
                  
                 <!-- </xsl:if> -->


   <xsl:if test="position() mod 4 = 0">

   <xsl:text disable-output-escaping="yes">
      &lt;/tr&gt;
      &lt;tr&gt;
   </xsl:text>

   </xsl:if>

         
            
            </xsl:for-each>
         </tr>
      </table>
      
   </xsl:template>
   
   <!-- /// Метки для информационного элемента /// -->
   <xsl:template match="tags/tag">
      <a href="{/document/blocks/url}tag/{tag_path_name}/" class="tag">
         <xsl:value-of select="tag_name"/>
      </a>
   <xsl:if test="position() != last()">,</xsl:if>&#xA0;</xsl:template>
   
   <!-- Цикл для вывода строк ссылок -->
   <xsl:template name="for">
      <xsl:param name="i" select="0"/>
      <xsl:param name="prefix">page</xsl:param>
      <xsl:param name="link"/>
      <xsl:param name="items_on_page"/>
      <xsl:param name="current_page"/>
      <xsl:param name="count_items"/>
      <xsl:param name="visible_pages"/>
      
      <xsl:variable name="n" select="$count_items div $items_on_page"/>
      
      <!-- Заносим в переменную $parent_group_id идентификатор текущей группы -->
      <xsl:variable name="parent_group_id" select="/document/blocks/parent_group_id"/>
      
      
      <!-- Считаем количество выводимых ссылок перед текущим элементом -->
      <xsl:variable name="pre_count_page">
         <xsl:choose>
            <xsl:when test="$current_page &gt; ($n - (round($visible_pages div 2) - 1))">
               <xsl:value-of select="$visible_pages - ($n - $current_page)"/>
            </xsl:when>
            <xsl:otherwise>
               <xsl:value-of select="round($visible_pages div 2) - 1"/>
            </xsl:otherwise>
         </xsl:choose>
      </xsl:variable>
      
      <!-- Считаем количество выводимых ссылок после текущего элемента -->
      <xsl:variable name="post_count_page">
         <xsl:choose>
            <xsl:when test="0 &gt; $current_page - (round($visible_pages div 2) - 1)">
               <xsl:value-of select="$visible_pages - $current_page - 1"/>
            </xsl:when>
            <xsl:otherwise>
               <xsl:choose>
                  <xsl:when test="round($visible_pages div 2) = ($visible_pages div 2)">
                     <xsl:value-of select="$visible_pages div 2"/>
                  </xsl:when>
                  <xsl:otherwise>
                     <xsl:value-of select="round($visible_pages div 2) - 1"/>
                  </xsl:otherwise>
               </xsl:choose>
            </xsl:otherwise>
         </xsl:choose>
      </xsl:variable>
      
      <xsl:if test="$i = 0 and $current_page != 0">
         <span class="ctrl">&#x2190;
         Ctrl</span>
      </xsl:if>
      
      <xsl:if test="$i &gt;= $n and ($n - 1) &gt; $current_page">
         <span class="ctrl">Ctrl &#x2192;</span>
      </xsl:if>
      
      <xsl:if test="$count_items &gt; $items_on_page and $n &gt; $i">
         
         <!-- Определяем адрес тэга -->
         <xsl:variable name="tag_link">
            <xsl:choose>
               <!-- Если не нулевой уровень -->
               <xsl:when test="count(/document/blocks/selected_tags/tag) != 0">tag/<xsl:value-of select="/document/blocks/selected_tags/tag/tag_path_name"/>/</xsl:when>
               <!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
               <xsl:otherwise></xsl:otherwise>
            </xsl:choose>
         </xsl:variable>
         
         <!-- Определяем адрес ссылки -->
         <xsl:variable name="number_link">
            <xsl:choose>
               <!-- Если не нулевой уровень -->
               <xsl:when test="$i != 0">
                  <xsl:value-of select="$prefix"/>-<xsl:value-of select="$i + 1"/>/</xsl:when>
               <!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
               <xsl:otherwise></xsl:otherwise>
            </xsl:choose>
         </xsl:variable>
         
         <!-- Ставим ссылку на страницу-->
         <xsl:if test="$i != $current_page">
            <!-- Выводим ссылку на первую страницу -->
            <xsl:if test="$current_page - $pre_count_page &gt; 0 and $i = 0">
               <a href="{$link}" class="page_link" style="text-decoration: none;">&#x2190;</a>
            </xsl:if>
            
            <xsl:choose>
               <xsl:when test="$i &gt;= ($current_page - $pre_count_page) and ($current_page + $post_count_page) &gt;= $i">
                  <!-- Выводим ссылки на видимые страницы -->
                  <a href="{$link}{$tag_link}{$number_link}" class="page_link">
                     <xsl:value-of select="$i + 1"/>
                  </a>
               </xsl:when>
               <xsl:otherwise></xsl:otherwise>
            </xsl:choose>
            
            <!-- Выводим ссылку на последнюю страницу -->
            <xsl:if test="$i+1 &gt;= $n and $n &gt; ($current_page + 1 + $post_count_page)">
               <xsl:choose>
                  <xsl:when test="$n &gt; round($n)">
                     <!-- Выводим ссылку на последнюю страницу -->
                     <a href="{$link}{$prefix}-{round($n+1)}/" class="page_link" style="text-decoration: none;">&#x2192;</a>
                  </xsl:when>
                  <xsl:otherwise>
                     <a href="{$link}{$prefix}-{round($n)}/" class="page_link" style="text-decoration: none;">&#x2192;</a>
                  </xsl:otherwise>
               </xsl:choose>
            </xsl:if>
         </xsl:if>
         
         <!-- Ссылка на предыдущую страницу для Ctrl + влево -->
         <xsl:if test="$current_page != 0 and $i = $current_page">
            <xsl:variable name="prev_number_link">
               <xsl:choose>
                  <!-- Если не нулевой уровень -->
                  <xsl:when test="($current_page - 1) != 0">page-<xsl:value-of select="$i"/>/</xsl:when>
                  <!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
                  <xsl:otherwise></xsl:otherwise>
               </xsl:choose>
            </xsl:variable>
            
            <a href="{$link}{$tag_link}{$prev_number_link}" id="id_prev"></a>
         </xsl:if>
         
         <!-- Ссылка на следующую страницу для Ctrl + вправо -->
         <xsl:if test="($n - 1) &gt; $current_page and $i = $current_page">
            <a href="{$link}{$tag_link}page-{$current_page+2}/" id="id_next"></a>
         </xsl:if>
         
         <!-- Не ставим ссылку на страницу-->
         <xsl:if test="$i = $current_page">
            <span class="current">
               <xsl:value-of select="$i+1"/>
            </span>
         </xsl:if>
         
         <!-- Рекурсивный вызов шаблона. НЕОБХОДИМО ПЕРЕДАВАТЬ ВСЕ НЕОБХОДИМЫЕ ПАРАМЕТРЫ! -->
         <xsl:call-template name="for">
            <xsl:with-param name="i" select="$i + 1"/>
            <xsl:with-param name="prefix" select="$prefix"/>
            <xsl:with-param name="link" select="$link"/>
            <xsl:with-param name="items_on_page" select="$items_on_page"/>
            <xsl:with-param name="current_page" select="$current_page"/>
            <xsl:with-param name="count_items" select="$count_items"/>
            <xsl:with-param name="visible_pages" select="$visible_pages"/>
         </xsl:call-template>
      </xsl:if>
   </xsl:template>
   
   <!-- Склонение после числительных -->
   <xsl:template name="declension">
      
      <xsl:param name="number" select="number"/>
      
      <!-- Именительный падеж -->
      <xsl:variable name="nominative">
         <xsl:text>комментарий</xsl:text>
      </xsl:variable>
      
      <!-- Родительный падеж, единственное число -->
      <xsl:variable name="genitive_singular">
         <xsl:text>комментария</xsl:text>
      </xsl:variable>
      
      
      <xsl:variable name="genitive_plural">
         <xsl:text>комментариев</xsl:text>
      </xsl:variable>
      
      <xsl:variable name="last_digit">
         <xsl:value-of select="$number mod 10"/>
      </xsl:variable>
      
      <xsl:variable name="last_two_digits">
         <xsl:value-of select="$number mod 100"/>
      </xsl:variable>
      
      <xsl:choose>
         <xsl:when test="$last_digit = 1 and $last_two_digits != 11">
            <xsl:value-of select="$nominative"/>
         </xsl:when>
         <xsl:when test="$last_digit = 2 and $last_two_digits != 12    or $last_digit = 3 and $last_two_digits != 13    or $last_digit = 4 and $last_two_digits != 14">
            <xsl:value-of select="$genitive_singular"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:value-of select="$genitive_plural"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>
</xsl:stylesheet>



единственное, чего я не победил - это конструкцию с position(), пришлось юзать костыль из 4 версии
#
Re: Фотогалерея на одной странице
Концепция у заказчика изменилась Блин.
Теперь он хочет, чтобы таким образом были представлены по 2 группы на странице. Я так понимаю, с данным XSL шаблоном это невозможно? В какую сторону копать, не подскажете?
#
Re: Фотогалерея на одной странице
Есть кто живой?
#
Re: Фотогалерея на одной странице
up
Модератор
#
Re: Фотогалерея на одной странице
jaybe,
стандартно выбираются все группы текущего уровня, Вам нужно именно делить группы по N?
#
Re: Фотогалерея на одной странице
Там в каждой группе порядка 20-30 фото, групп на данный момент около 20, соответственно на одной странице получается неплохая такая простыня. Я предепреждал клиента об этом, но ему надо было увидеть все своими глазами (и оценить время загрузки). Теперь он хочет, чтобы групп было 2 на странице, в таком же виде как сейчас - название + описание + миниатюры всех элементов. Попытки изменить существующий XSL-шаблон потерпели крах.
Модератор
#
Re: Фотогалерея на одной странице
jaybe,
Посмотрите, пожалуйста, информацию в новом API:
http://www.hostcms.ru/api/HostCMS_5/InformationSystem.html#methodShowInformationSystem

Цитата:
$param['groups_on_page'] число информационных групп, отображаемых на странице
$param['groups_begin'] номер, начиная с которого выводить информационные группы
#
Re: Фотогалерея на одной странице
эээ... то ли лыжи не едут...
вот вывод ИС


ShowInformationSystem( mixed $InformationSystemIdArray, int $information_groups_id, string $xsl_name, int $items_on_page, int $items_begin, [array $external_propertys = array()], [array $property = array()] );


вот эти параметры


$param['groups_on_page'] число информационных групп, отображаемых на странице
$param['groups_begin'] номер, начиная с которого выводить информационные группы


не вижу в выводе ИС места под параметры
Модератор
#
Re: Фотогалерея на одной странице
jaybe,
имеется ввиду $property, наша ошибка при описании.
Авторизация