1
Шаблоны XSLT / Re:выборка usel
« : 28 Октября 2014, 20:00:56 »Заработало Спасибо огромущее
В этом разделе можно просмотреть все сообщения, сделанные этим пользователем.
<selection>
<target expected-result="pages">
<type id="130"/>
<category>{1}</category>
</target>
<property name="date_create_object"/>
</selection>
<xsl:template match="result[@module = 'catalog'][@method = 'category'][page/@type-id = '132']">
бла-бла-бла
<xsl:apply-templates select="document('usel://ingredients/', result/@pageId)/udata" mode="ingredients"/>
</xsl:template>
<xsl:template match="udata" mode="ingredients">
<xsl:apply-templates select="page" mode="ingredients-page"/>
</xsl:template>
<xsl:template match="page" mode="ingredients-page">
<h3>
<a href="{@link}"><xsl:value-of select="name" /></a>
</h3>
</xsl:template>
<xsl:template match="result[@module='news'][@method='item']">
<script type="text/javascript">
<xsl:text>
function setCommentParent(parentId) {
var form = document.getElementById('comment_add_form');
var editor = document.getElementById('message');
if(form)
form.action = '/comments/post/' + parentId + '/';
if(editor)
editor.focus();
</xsl:text>
</script>
<div id="news-item">
бла-бла-бла
</div>
<div id="comments">
<h3>Комментарии</h3>
<xsl:apply-templates select="document(concat('udata://comments/commentsList/', page/@id))/udata"/>
<xsl:apply-templates select="document(concat('udata://comments/commentsList/', /result/@pageId))/udata/action"/>
</div>
</xsl:template>
<xsl:template match="udata[@module = 'comments'][@method = 'commentsList'][items/item]">
<ul>
<xsl:apply-templates select="items/item" mode="comment" />
</ul>
</xsl:template>
<xsl:template match="item" mode="comment">
<li>
<xsl:apply-templates select="document(concat('udata://users/viewAuthor/', author_id))/udata" mode="author"/>
<span class="time"> / <xsl:value-of select="document(concat('udata://system/convertDate/', publish_time, '/(d.m.Y)/'))/udata"/></span>
<div class="message">
<xsl:value-of select="content" disable-output-escaping="yes" />
</div>
<p style="padding-bottom:20px;">
(<a href="#comment_add_form" onclick="javascript:setCommentParent({@cid});">Ответить</a>)
</p>
<div style="padding-left:30px;">
<xsl:value-of select="subcomments" disable-output-escaping="yes" />
</div>
</li>
</xsl:template>
<xsl:template match="udata" mode="author">
<span class="author"> <xsl:value-of select="nickname" /></span>
</xsl:template>
<xsl:template match="action">
<form method="post" action="{.}" name="comment_add_form" id="comment_add_form">
<fieldset class="intext">
<div class="ctrlHolder required">
<textarea name="comment" id="comment_text" cols="6" />
</div>
</fieldset>
<input class="submitButton" type="submit" value="Добавить комментарий"/>
</form>
</xsl:template>
<?php
$permissions = array(
'tree' => array('customNewsList'),
'view' => array('customNewsList'),
'lists' => Array('customNewsList')
);
?>
Parse error: syntax error, unexpected T_FUNCTION in U:\home\localhost\www\classes\modules\news\__custom.php on line 48
//сортируем элементы массива $resultItems по полю publish_time, то есть по дате публикации
usort($resultItems, function($a, $b){
$a_publishTime = $a->getValue('publish_time');
$b_publishTime = $b->getValue('publish_time');
if ($a_publishTime == $b_publishTime) {
return 0;
}
return ($a_publishTime > $b_publishTime) ? -1 : 1;
});