Есть ИС "Продукция" из групп и элементов. В меню они выводятся поэтапно - сначала все группы, потом элементы. Сортировка действует, но только внутри этих разделов.
Как сделать сквозную сортировку?
Вызов шаблона из макета:
<?
if (Core::moduleIsActive('informationsystem'))
{
$Informationsystem_Controller_Show = new Informationsystem_Controller_Show(
Core_Entity::factory('Informationsystem', 2)
);
$Informationsystem_Controller_Show
->xsl(
Core_Entity::factory('Xsl')->getByName('СписокЭлементовКаталогНаГлавной')
)
->groupsMode('all')
->itemsForbiddenTags(array('text', 'description'))
->group(FALSE)
->limit(9999)
->show();
}
?>
Сам шаблон:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:hostcms="http://www.hostcms.ru/"
exclude-result-prefixes="hostcms">
<xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" encoding="utf-8" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml"/>
<!-- СписокЭлементовИнфосистемы -->
<xsl:template match="/">
<xsl:apply-templates select="/informationsystem"/>
</xsl:template>
<xsl:variable name="n" select="number(3)"/>
<xsl:template match="/informationsystem">
<xsl:variable name="group" select="group"/>
<div class="left_buttons">
<xsl:apply-templates select="informationsystem_group"/> <xsl:apply-templates select="informationsystem_item"/>
</div>
</xsl:template>
<xsl:template match="informationsystem_group">
<xsl:variable name="curr_gr" select="@id"/>
<xsl:choose>
<xsl:when test="image_small!=''">
<a class="l_but {$curr_gr}">
<xsl:attribute name="href">
<xsl:value-of select="url" disable-output-escaping="yes"/>
</xsl:attribute>
<xsl:attribute name="style">
background:url('<xsl:value-of select="dir" disable-output-escaping="yes"/><xsl:value-of select="image_small" disable-output-escaping="yes"/>') no-repeat center center
</xsl:attribute>
<div class="l_but_text">
<xsl:value-of select="name" disable-output-escaping="yes"/>
</div>
</a>
</xsl:when>
<xsl:otherwise>
<a class="l_but_noimage" href="{url}">
<div class="l_but_noimage_text">
<xsl:value-of select="name" disable-output-escaping="yes"/>
</div>
</a>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Шаблон вывода информационного элемента -->
<xsl:template match="informationsystem_item">
<xsl:variable name="group" select="informationsystem_group_id"/>
<xsl:if test="$group = 0">
<xsl:choose>
<xsl:when test="image_small!=''">
<a class="l_but">
<xsl:attribute name="style">
background:url('<xsl:value-of select="dir" disable-output-escaping="yes"/><xsl:value-of select="image_small" disable-output-escaping="yes"/>') no-repeat center center
</xsl:attribute>
<div class="l_but_text A{$group}">
<xsl:value-of select="name" disable-output-escaping="yes"/>
</div>
</a>
</xsl:when>
<xsl:otherwise>
<a class="l_but_noimage" href="{url}">
<div class="l_but_noimage_text">
<xsl:value-of select="name" disable-output-escaping="yes"/>
</div>
</a>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
</xsl:stylesheet>