Альбомы в фотогалерее
Доброго времени суток!
Дело в том, что я никак не могу создать альбомы для фотогалереи. Создаю подгруппы в ИС/Фотогалерея, распределяю фотографии, но они все равно вливаются в одну кучу. Когда посетители заходят в раздел "Фотогалерея", то видят не альбомы, а все изображения разом.
Как можно сделать так, чтобы выводились альбомы при клике на раздел "Фотогалерея", а не сразу все изображения?
Помогите с этим вопросом! ))
Заранее благодарен!
Дело в том, что я никак не могу создать альбомы для фотогалереи. Создаю подгруппы в ИС/Фотогалерея, распределяю фотографии, но они все равно вливаются в одну кучу. Когда посетители заходят в раздел "Фотогалерея", то видят не альбомы, а все изображения разом.
Как можно сделать так, чтобы выводились альбомы при клике на раздел "Фотогалерея", а не сразу все изображения?
Помогите с этим вопросом! ))
Заранее благодарен!
emiraizh,
В ТДС фотогалереи уберите:
В ТДС фотогалереи уберите:
->group(FALSE)
Вы только что начали читать предложение, чтение которого вы уже заканчиваете.
alexander.egorov, Спасибо за совет. )
Я убрал. Но теперь В этом разделе ничего не показывает и выдает вот это:
Замечание: Undefined variable: Inforfmationsystem_Controller_Show в файле /var/www/vhosts/u9083331.plsk.regruhosting.ru/ipar.kg/hostcmsfiles/lib/lib_83/lib_83.php (строка 5)Замечание: Trying to get property of non-object в файле /var/www/vhosts/u9083331.plsk.regruhosting.ru/ipar.kg/hostcmsfiles/lib/lib_83/lib_83.php (строка 5)
Я убрал. Но теперь В этом разделе ничего не показывает и выдает вот это:
Замечание: Undefined variable: Inforfmationsystem_Controller_Show в файле /var/www/vhosts/u9083331.plsk.regruhosting.ru/ipar.kg/hostcmsfiles/lib/lib_83/lib_83.php (строка 5)Замечание: Trying to get property of non-object в файле /var/www/vhosts/u9083331.plsk.regruhosting.ru/ipar.kg/hostcmsfiles/lib/lib_83/lib_83.php (строка 5)
emiraizh писал(а):
Код ТДС покажете?
Я убрал. Но теперь В этом разделе ничего не показывает и выдает вот это:
Код ТДС покажете?
E-mail: info@syrbek.ru / телега: @syrbek /skype: activexm / syrbek.ru / Поддержка сайтов / г. Москва [HTML, CSS (Bootstrap), JS(JQuery, ExtJS), PHP, MySQL, MSSql, Posgres, Git, SVN, Redmine]
Seri,
<?php
$Informationsystem_Controller_Show = Core_Page::instance()->object;
$xslName = $Inforfmationsystem_Controller_Show->item
? Core_Array::get(Core_Page::instance()->libParams, 'informationsystemItemXsl'
: Core_Array::get(Core_Page::instance()->libParams, 'informationsystemXsl'
;
$Informationsystem_Controller_Show->addEntity(
Core::factory('Core_Xml_Entity'
->name('ОтображатьСсылкуНаАрхив'
->value(0)
)->addEntity(
Core::factory('Core_Xml_Entity'
->name('ОтображатьСсылкиНаСледующиеСтраницы'
->value(1)
)->addEntity(
Core::factory('Core_Xml_Entity'
->name('ТекущаяГруппа'
->value($Informationsystem_Controller_Show->group)
)->addEntity(
Core::factory('Core_Xml_Entity'
->name('show_comments'
->value(
intval(Core_Array::get(Core_Page::instance()->libParams, 'showComments', 1))
)
)->addEntity(
Core::factory('Core_Xml_Entity'
->name('show_add_comments'
->value(
intval(Core_Array::get(Core_Page::instance()->libParams, 'showAddComment', 2))
)
);
$Informationsystem_Controller_Show
->tags(TRUE)
->comments(TRUE);
if ($Informationsystem_Controller_Show->item == 0)
{
$Informationsystem_Controller_Show->itemsForbiddenTags(array('text'
);
}
else
{
if (Core_Array::getPost('add_comment'
&& Core_Array::get(Core_Page::instance()->libParams, 'showAddComment'
!= 0)
{
$Informationsystem_Controller_Show->cache(FALSE);
$oLastComment = Core_Entity::factory('Comment'
->getLastCommentByIp(
Core_Array::get($_SERVER, 'REMOTE_ADDR'
);
$oXmlCommentTag = Core::factory('Core_Xml_Entity'
->name('document'
;
$siteuser_id = 0;
if (Core::moduleIsActive('siteuser'
)
{
$oSiteuser = Core_Entity::factory('Siteuser'
->getCurrent();
if ($oSiteuser)
{
$siteuser_id = $oSiteuser->id;
}
}
$oComment = Core_Entity::factory('Comment'
;
$allowable_tags = '<b><strong><i><em><br><p><u><strike><ul><ol><li>';
$oComment->parent_id = intval(Core_Array::getPost('parent_id', 0));
$oComment->active = Core_Array::get(Core_Page::instance()->libParams, 'addedCommentActive', 1) == 1 ? 1 : 0;
$oComment->author = Core_Str::stripTags(Core_Array::getPost('author'
);
$oComment->email = Core_Str::stripTags(Core_Array::getPost('email'
);
$oComment->phone = Core_Str::stripTags(Core_Array::getPost('phone'
);
$oComment->grade = intval(Core_Array::getPost('grade', 0));
$oComment->subject = Core_Str::stripTags(Core_Array::getPost('subject'
);
$oComment->text = nl2br(Core_Str::stripTags(Core_Array::getPost('text'
, $allowable_tags));
$oComment->siteuser_id = $siteuser_id;
$oInformationsystem_Item = Core_Entity::factory('Informationsystem_Item', $Informationsystem_Controller_Show->item);
$oXmlCommentTag
->addEntity($oComment)
->addEntity($oInformationsystem_Item);
if (is_null($oLastComment) || time() > Core_Date::sql2timestamp($oLastComment->datetime) + ADD_COMMENT_DELAY)
{
$oInformationsystem = $Informationsystem_Controller_Show->getEntity();
if ($oInformationsystem->use_captcha == 0 || $siteuser_id > 0 || Core_Captcha::valid(Core_Array::getPost('captcha_id'
, Core_Array::getPost('captcha'
))
{
$oComment->save();
$oInformationsystem_Item->add($oComment)->clearCache();
$oXmlCommentTag->addEntity($oInformationsystem);
// Отправка письма администратору
$sText = Xsl_Processor::instance()
->xml($oXmlCommentTag->getXml())
->xsl(Core_Entity::factory('Xsl'
->getByName(Core_Array::get(Core_Page::instance()->libParams, 'addCommentAdminMailXsl'
))
->process();
$oCore_Mail_Driver = Core_Mail::instance()
->to(EMAIL_TO)
->from(Core_Valid::email($oComment->email)
? $oComment->email
: EMAIL_TO
)
->subject(Core::_('Informationsystem.comment_mail_subject'
)
->message(trim($sText))
->contentType(Core_Array::get(Core_Page::instance()->libParams, 'commentMailNoticeType', 0) == 0
? 'text/plain'
: 'text/html'
)
->send();
}
else
{
$oXmlCommentTag->addEntity(Core::factory('Core_Xml_Entity'
->name('error_captcha'
->value(1)
);
$oComment->text = Core_Str::br2nl($oComment->text);
$Informationsystem_Controller_Show->addEntity($oComment);
}
}
else
{
$oXmlCommentTag->addEntity(Core::factory('Core_Xml_Entity'
->name('error_time'
->value(1)
);
$oComment->text = Core_Str::br2nl($oComment->text);
$Informationsystem_Controller_Show->addEntity($oComment);
}
// Результат добавления комментария
$xsl_result = Xsl_Processor::instance()
->xml($oXmlCommentTag->getXml())
->xsl(Core_Entity::factory('Xsl'
->getByName(
Core_Array::get(Core_Page::instance()->libParams, 'addCommentNoticeXsl'
)
)
->process();
$Informationsystem_Controller_Show->addEntity(
Core::factory('Core_Xml_Entity'
->name('message'
->value($xsl_result)
);
}
}
$Informationsystem_Controller_Show
->xsl(
Core_Entity::factory('Xsl'
->getByName($xslName)
)
->itemsProperties(TRUE)
->group(TRUE)
->show();
<?php
$Informationsystem_Controller_Show = Core_Page::instance()->object;
$xslName = $Inforfmationsystem_Controller_Show->item
? Core_Array::get(Core_Page::instance()->libParams, 'informationsystemItemXsl'

: Core_Array::get(Core_Page::instance()->libParams, 'informationsystemXsl'
;$Informationsystem_Controller_Show->addEntity(
Core::factory('Core_Xml_Entity'

->name('ОтображатьСсылкуНаАрхив'
->value(0))->addEntity(
Core::factory('Core_Xml_Entity'

->name('ОтображатьСсылкиНаСледующиеСтраницы'
->value(1))->addEntity(
Core::factory('Core_Xml_Entity'

->name('ТекущаяГруппа'
->value($Informationsystem_Controller_Show->group))->addEntity(
Core::factory('Core_Xml_Entity'

->name('show_comments'
->value(intval(Core_Array::get(Core_Page::instance()->libParams, 'showComments', 1))
)
)->addEntity(
Core::factory('Core_Xml_Entity'

->name('show_add_comments'
->value(intval(Core_Array::get(Core_Page::instance()->libParams, 'showAddComment', 2))
)
);
$Informationsystem_Controller_Show
->tags(TRUE)
->comments(TRUE);
if ($Informationsystem_Controller_Show->item == 0)
{
$Informationsystem_Controller_Show->itemsForbiddenTags(array('text'
);}
else
{
if (Core_Array::getPost('add_comment'
&& Core_Array::get(Core_Page::instance()->libParams, 'showAddComment'
!= 0){
$Informationsystem_Controller_Show->cache(FALSE);
$oLastComment = Core_Entity::factory('Comment'
->getLastCommentByIp(Core_Array::get($_SERVER, 'REMOTE_ADDR'

);
$oXmlCommentTag = Core::factory('Core_Xml_Entity'

->name('document'
;$siteuser_id = 0;
if (Core::moduleIsActive('siteuser'
){
$oSiteuser = Core_Entity::factory('Siteuser'
->getCurrent();if ($oSiteuser)
{
$siteuser_id = $oSiteuser->id;
}
}
$oComment = Core_Entity::factory('Comment'
;$allowable_tags = '<b><strong><i><em><br><p><u><strike><ul><ol><li>';
$oComment->parent_id = intval(Core_Array::getPost('parent_id', 0));
$oComment->active = Core_Array::get(Core_Page::instance()->libParams, 'addedCommentActive', 1) == 1 ? 1 : 0;
$oComment->author = Core_Str::stripTags(Core_Array::getPost('author'
);$oComment->email = Core_Str::stripTags(Core_Array::getPost('email'
);$oComment->phone = Core_Str::stripTags(Core_Array::getPost('phone'
);$oComment->grade = intval(Core_Array::getPost('grade', 0));
$oComment->subject = Core_Str::stripTags(Core_Array::getPost('subject'
);$oComment->text = nl2br(Core_Str::stripTags(Core_Array::getPost('text'
, $allowable_tags));$oComment->siteuser_id = $siteuser_id;
$oInformationsystem_Item = Core_Entity::factory('Informationsystem_Item', $Informationsystem_Controller_Show->item);
$oXmlCommentTag
->addEntity($oComment)
->addEntity($oInformationsystem_Item);
if (is_null($oLastComment) || time() > Core_Date::sql2timestamp($oLastComment->datetime) + ADD_COMMENT_DELAY)
{
$oInformationsystem = $Informationsystem_Controller_Show->getEntity();
if ($oInformationsystem->use_captcha == 0 || $siteuser_id > 0 || Core_Captcha::valid(Core_Array::getPost('captcha_id'
, Core_Array::getPost('captcha'
)){
$oComment->save();
$oInformationsystem_Item->add($oComment)->clearCache();
$oXmlCommentTag->addEntity($oInformationsystem);
// Отправка письма администратору
$sText = Xsl_Processor::instance()
->xml($oXmlCommentTag->getXml())
->xsl(Core_Entity::factory('Xsl'
->getByName(Core_Array::get(Core_Page::instance()->libParams, 'addCommentAdminMailXsl'
))->process();
$oCore_Mail_Driver = Core_Mail::instance()
->to(EMAIL_TO)
->from(Core_Valid::email($oComment->email)
? $oComment->email
: EMAIL_TO
)
->subject(Core::_('Informationsystem.comment_mail_subject'
)->message(trim($sText))
->contentType(Core_Array::get(Core_Page::instance()->libParams, 'commentMailNoticeType', 0) == 0
? 'text/plain'
: 'text/html'
)
->send();
}
else
{
$oXmlCommentTag->addEntity(Core::factory('Core_Xml_Entity'

->name('error_captcha'
->value(1));
$oComment->text = Core_Str::br2nl($oComment->text);
$Informationsystem_Controller_Show->addEntity($oComment);
}
}
else
{
$oXmlCommentTag->addEntity(Core::factory('Core_Xml_Entity'

->name('error_time'
->value(1));
$oComment->text = Core_Str::br2nl($oComment->text);
$Informationsystem_Controller_Show->addEntity($oComment);
}
// Результат добавления комментария
$xsl_result = Xsl_Processor::instance()
->xml($oXmlCommentTag->getXml())
->xsl(Core_Entity::factory('Xsl'
->getByName(Core_Array::get(Core_Page::instance()->libParams, 'addCommentNoticeXsl'
))
->process();
$Informationsystem_Controller_Show->addEntity(
Core::factory('Core_Xml_Entity'

->name('message'
->value($xsl_result));
}
}
$Informationsystem_Controller_Show
->xsl(
Core_Entity::factory('Xsl'
->getByName($xslName))
->itemsProperties(TRUE)
->group(TRUE)
->show();
Покажите код Настройки страницы?
E-mail: info@syrbek.ru / телега: @syrbek /skype: activexm / syrbek.ru / Поддержка сайтов / г. Москва [HTML, CSS (Bootstrap), JS(JQuery, ExtJS), PHP, MySQL, MSSql, Posgres, Git, SVN, Redmine]
Подозреваю что у вас переменная Inforfmationsystem_Controller_Show без знака $ доллара. По ошибке пишет что не определенная переменная.
E-mail: info@syrbek.ru / телега: @syrbek /skype: activexm / syrbek.ru / Поддержка сайтов / г. Москва [HTML, CSS (Bootstrap), JS(JQuery, ExtJS), PHP, MySQL, MSSql, Posgres, Git, SVN, Redmine]
Seri, Поставил $, но все равно не работает ((
Здесь скрины всего кода страницы и настройки страницы:
А так вот сам код "Настройки страницы", если будет сложновато скачать архив скринов:
<?php
$oInformationsystem = Core_Entity::factory('Informationsystem', Core_Array::get(Core_Page::instance()->libParams, 'informationsystemId'
);
$Informationsystem_Controller_Show = new Informationsystem_Controller_Show($oInformationsystem);
$Informationsystem_Controller_Show
->limit($oInformationsystem->items_on_page)
->parseUrl();
// Текстовая информация для указания номера страницы, например "страница"
$pageName = Core_Array::get(Core_Page::instance()->libParams, 'page'
? Core_Array::get(Core_Page::instance()->libParams, 'page'
: 'страница';
// Разделитель в заголовке страницы
$pageSeparator = Core_Array::get(Core_Page::instance()->libParams, 'separator'
? Core_Page::instance()->libParams['separator']
: ' / ';
if (!is_null(Core_Array::getGet('vote'
))
{
$oSiteuser = Core_Entity::factory('Siteuser'
->getCurrent();
$entity_id = intval(Core_Array::getGet('id'
);
if ($entity_id && !is_null($oSiteuser))
{
$entity_type = strval(Core_Array::getGet('entity_type'
);
$vote = intval(Core_Array::getGet('vote'
);
$oObject = Vote_Controller::instance()->getVotedObject($entity_type, $entity_id);
if (!is_null($oObject))
{
$oVote = $oObject->Votes->getBySiteuser_Id($oSiteuser->id);
$vote_value = $vote ? 1 : -1;
$deleteVote = 0;
// Пользователь не голосовал ранее
if (is_null($oVote))
{
$oVote = Core_Entity::factory('Vote'
;
$oVote->siteuser_id = $oSiteuser->id;
$oVote->value = $vote_value;
$oObject->add($oVote);
}
// Пользователь голосовал ранее, но поставил противоположную оценку
elseif ($oVote->value != $vote_value)
{
$oVote->value = $vote_value;
$oVote->save();
}
// Пользователь голосовал ранее и поставил такую же оценку как и ранее, обнуляем его голосование, как будто он вообще не голосовал
else
{
$deleteVote = 1;
$oVote->delete();
}
$aVotingStatistic = Vote_Controller::instance()->getRate($entity_type, $entity_id);
Core_Page::instance()->response
->body(
json_encode(array('value' => $oVote->value, 'item' => $oObject->id, 'entity_type' => $entity_type,
'likes' => $aVotingStatistic['likes'], 'dislikes' => $aVotingStatistic['dislikes'],
'rate' => $aVotingStatistic['rate'], 'delete_vote' => $deleteVote)
)
);
}
}
Core_Page::instance()->response
->status(200)
->header('Pragma', "no-cache"
->header('Cache-Control', "private, no-cache"
->header('Vary', "Accept"
->header('Last-Modified', gmdate('D, d M Y H:i:s', time()) . ' GMT'
->header('X-Powered-By', 'HostCMS'
->header('Content-Disposition', 'inline; filename="files.json"'
;
if (strpos(Core_Array::get($_SERVER, 'HTTP_ACCEPT', ''
, 'application/json'
!== FALSE)
{
Core_Page::instance()->response->header('Content-type', 'application/json; charset=utf-8'
;
}
else
{
Core_Page::instance()->response
->header('X-Content-Type-Options', 'nosniff'
->header('Content-type', 'text/plain; charset=utf-8'
;
}
if(Core_Array::getRequest('_'
)
{
Core_Page::instance()->response
->sendHeaders()
->showBody();
exit();
}
}
$aTitle = array($oInformationsystem->name);
$aDescription = array($oInformationsystem->name);
$aKeywords = array($oInformationsystem->name);
if (!is_null($Informationsystem_Controller_Show->tag) && Core::moduleIsActive('tag'
)
{
$oTag = Core_Entity::factory('Tag'
->getByPath($Informationsystem_Controller_Show->tag);
if ($oTag)
{
$aTitle[] = $oTag->seo_title != '' ? $oTag->seo_title : Core::_('Informationsystem.tag', $oTag->name);
$aDescription[] = $oTag->seo_description != '' ? $oTag->seo_description : $oTag->name;
$aKeywords[] = $oTag->seo_keywords != '' ? $oTag->seo_keywords : $oTag->name;
}
}
if ($Informationsystem_Controller_Show->group)
{
$oInformationsystem_Group = Core_Entity::factory('Informationsystem_Group', $Informationsystem_Controller_Show->group);
do {
$aTitle[] = $oInformationsystem_Group->seo_title != ''
? $oInformationsystem_Group->seo_title
: $oInformationsystem_Group->name;
$aDescription[] = $oInformationsystem_Group->seo_description != ''
? $oInformationsystem_Group->seo_description
: $oInformationsystem_Group->name;
$aKeywords[] = $oInformationsystem_Group->seo_keywords != ''
? $oInformationsystem_Group->seo_keywords
: $oInformationsystem_Group->name;
} while($oInformationsystem_Group = $oInformationsystem_Group->getParent());
}
if ($Informationsystem_Controller_Show->item)
{
$oInformationsystem_Item = Core_Entity::factory('Informationsystem_Item', $Informationsystem_Controller_Show->item);
$aTitle[] = $oInformationsystem_Item->seo_title != ''
? $oInformationsystem_Item->seo_title
: $oInformationsystem_Item->name;
$aDescription[] = $oInformationsystem_Item->seo_description != ''
? $oInformationsystem_Item->seo_description
: $oInformationsystem_Item->name;
$aKeywords[] = $oInformationsystem_Item->seo_keywords != ''
? $oInformationsystem_Item->seo_keywords
: $oInformationsystem_Item->name;
}
if ($Informationsystem_Controller_Show->page)
{
array_unshift($aTitle, $pageName . ' ' . ($Informationsystem_Controller_Show->page + 1));
}
if (count($aTitle) > 1)
{
$aTitle = array_reverse($aTitle);
$aDescription = array_reverse($aDescription);
$aKeywords = array_reverse($aKeywords);
Core_Page::instance()->title(implode($pageSeparator, $aTitle));
Core_Page::instance()->description(implode($pageSeparator, $aDescription));
Core_Page::instance()->keywords(implode($pageSeparator, $aKeywords));
}
Core_Page::instance()->object = $Informationsystem_Controller_Show;
Здесь скрины всего кода страницы и настройки страницы:
А так вот сам код "Настройки страницы", если будет сложновато скачать архив скринов:
<?php
$oInformationsystem = Core_Entity::factory('Informationsystem', Core_Array::get(Core_Page::instance()->libParams, 'informationsystemId'
);$Informationsystem_Controller_Show = new Informationsystem_Controller_Show($oInformationsystem);
$Informationsystem_Controller_Show
->limit($oInformationsystem->items_on_page)
->parseUrl();
// Текстовая информация для указания номера страницы, например "страница"
$pageName = Core_Array::get(Core_Page::instance()->libParams, 'page'

? Core_Array::get(Core_Page::instance()->libParams, 'page'

: 'страница';
// Разделитель в заголовке страницы
$pageSeparator = Core_Array::get(Core_Page::instance()->libParams, 'separator'

? Core_Page::instance()->libParams['separator']
: ' / ';
if (!is_null(Core_Array::getGet('vote'
)){
$oSiteuser = Core_Entity::factory('Siteuser'
->getCurrent();$entity_id = intval(Core_Array::getGet('id'
);if ($entity_id && !is_null($oSiteuser))
{
$entity_type = strval(Core_Array::getGet('entity_type'
);$vote = intval(Core_Array::getGet('vote'
);$oObject = Vote_Controller::instance()->getVotedObject($entity_type, $entity_id);
if (!is_null($oObject))
{
$oVote = $oObject->Votes->getBySiteuser_Id($oSiteuser->id);
$vote_value = $vote ? 1 : -1;
$deleteVote = 0;
// Пользователь не голосовал ранее
if (is_null($oVote))
{
$oVote = Core_Entity::factory('Vote'
;$oVote->siteuser_id = $oSiteuser->id;
$oVote->value = $vote_value;
$oObject->add($oVote);
}
// Пользователь голосовал ранее, но поставил противоположную оценку
elseif ($oVote->value != $vote_value)
{
$oVote->value = $vote_value;
$oVote->save();
}
// Пользователь голосовал ранее и поставил такую же оценку как и ранее, обнуляем его голосование, как будто он вообще не голосовал
else
{
$deleteVote = 1;
$oVote->delete();
}
$aVotingStatistic = Vote_Controller::instance()->getRate($entity_type, $entity_id);
Core_Page::instance()->response
->body(
json_encode(array('value' => $oVote->value, 'item' => $oObject->id, 'entity_type' => $entity_type,
'likes' => $aVotingStatistic['likes'], 'dislikes' => $aVotingStatistic['dislikes'],
'rate' => $aVotingStatistic['rate'], 'delete_vote' => $deleteVote)
)
);
}
}
Core_Page::instance()->response
->status(200)
->header('Pragma', "no-cache"

->header('Cache-Control', "private, no-cache"

->header('Vary', "Accept"

->header('Last-Modified', gmdate('D, d M Y H:i:s', time()) . ' GMT'

->header('X-Powered-By', 'HostCMS'

->header('Content-Disposition', 'inline; filename="files.json"'
;if (strpos(Core_Array::get($_SERVER, 'HTTP_ACCEPT', ''
, 'application/json'
!== FALSE){
Core_Page::instance()->response->header('Content-type', 'application/json; charset=utf-8'
;}
else
{
Core_Page::instance()->response
->header('X-Content-Type-Options', 'nosniff'

->header('Content-type', 'text/plain; charset=utf-8'
;}
if(Core_Array::getRequest('_'
){
Core_Page::instance()->response
->sendHeaders()
->showBody();
exit();
}
}
$aTitle = array($oInformationsystem->name);
$aDescription = array($oInformationsystem->name);
$aKeywords = array($oInformationsystem->name);
if (!is_null($Informationsystem_Controller_Show->tag) && Core::moduleIsActive('tag'
){
$oTag = Core_Entity::factory('Tag'
->getByPath($Informationsystem_Controller_Show->tag);if ($oTag)
{
$aTitle[] = $oTag->seo_title != '' ? $oTag->seo_title : Core::_('Informationsystem.tag', $oTag->name);
$aDescription[] = $oTag->seo_description != '' ? $oTag->seo_description : $oTag->name;
$aKeywords[] = $oTag->seo_keywords != '' ? $oTag->seo_keywords : $oTag->name;
}
}
if ($Informationsystem_Controller_Show->group)
{
$oInformationsystem_Group = Core_Entity::factory('Informationsystem_Group', $Informationsystem_Controller_Show->group);
do {
$aTitle[] = $oInformationsystem_Group->seo_title != ''
? $oInformationsystem_Group->seo_title
: $oInformationsystem_Group->name;
$aDescription[] = $oInformationsystem_Group->seo_description != ''
? $oInformationsystem_Group->seo_description
: $oInformationsystem_Group->name;
$aKeywords[] = $oInformationsystem_Group->seo_keywords != ''
? $oInformationsystem_Group->seo_keywords
: $oInformationsystem_Group->name;
} while($oInformationsystem_Group = $oInformationsystem_Group->getParent());
}
if ($Informationsystem_Controller_Show->item)
{
$oInformationsystem_Item = Core_Entity::factory('Informationsystem_Item', $Informationsystem_Controller_Show->item);
$aTitle[] = $oInformationsystem_Item->seo_title != ''
? $oInformationsystem_Item->seo_title
: $oInformationsystem_Item->name;
$aDescription[] = $oInformationsystem_Item->seo_description != ''
? $oInformationsystem_Item->seo_description
: $oInformationsystem_Item->name;
$aKeywords[] = $oInformationsystem_Item->seo_keywords != ''
? $oInformationsystem_Item->seo_keywords
: $oInformationsystem_Item->name;
}
if ($Informationsystem_Controller_Show->page)
{
array_unshift($aTitle, $pageName . ' ' . ($Informationsystem_Controller_Show->page + 1));
}
if (count($aTitle) > 1)
{
$aTitle = array_reverse($aTitle);
$aDescription = array_reverse($aDescription);
$aKeywords = array_reverse($aKeywords);
Core_Page::instance()->title(implode($pageSeparator, $aTitle));
Core_Page::instance()->description(implode($pageSeparator, $aDescription));
Core_Page::instance()->keywords(implode($pageSeparator, $aKeywords));
}
Core_Page::instance()->object = $Informationsystem_Controller_Show;
У меня только вчера такая же задача стояла, сделать группы в фотогалереи. Правила XLS, так как в последней версии 6 нет данных про группы! Можно из предыдущих взять!
Вот мой XLS
<?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:template match="/informationsystem">
<!-- Получаем ID родительской группы и записываем в переменную $group -->
<xsl:variable name="group" select="group"/>
<!-- Если в находимся корне - выводим название информационной системы -->
<xsl:if test="group = 0">
<h1>
<xsl:value-of disable-output-escaping="yes" select="name"/>
</h1>
<!-- Описание выводится при отсутствии фильтрации по тэгам -->
<xsl:if test="count(tag) = 0">
<xsl:value-of disable-output-escaping="yes" select="description"/>
</xsl:if>
</xsl:if>
<!-- Если в находимся в группе - выводим название группы -->
<xsl:if test="group != 0">
<h1>
<xsl:value-of disable-output-escaping="yes" select=".//informationsystem_group[@id=$group]/name"/>
</h1>
<!-- Описание выводим только на первой странице -->
<xsl:if test="page = 0">
<xsl:value-of disable-output-escaping="yes" select=".//informationsystem_group[@id=$group]/description"/>
</xsl:if>
</xsl:if>
<!-- Обработка выбранных тэгов -->
<xsl:if test="count(tag) = 1">
<p class="h2">Метка — <strong><xsl:value-of select="tag/name"/></strong>.</p>
</xsl:if>
<!-- Отображение подгрупп данной группы, только если подгруппы есть и не идет фильтра по меткам -->
<xsl:if test="count(tag) = 0 and count(.//informationsystem_group[parent_id=$group]) > 0">
<ul class="polaroids">
<xsl:apply-templates select=".//informationsystem_group[parent_id=$group]" mode="groups"/>
</ul>
</xsl:if>
<xsl:if test="count(informationsystem_item)">
<!-- jQuery lightbox -->
<div id="gallery">
<div class="row">
<xsl:apply-templates select="informationsystem_item" />
</div>
</div>
</xsl:if>
<br class="clearing" />
<!-- Строка ссылок на другие страницы информационной системы -->
<xsl:if test="ОтображатьСсылкиНаСледующиеСтраницы=1">
<div>
<!-- Ссылка, для которой дописываются суффиксы page-XX/ -->
<xsl:variable name="link">
<xsl:value-of select="/informationsystem/url"/>
<xsl:if test="$group != 0">
<xsl:value-of select="/informationsystem//informationsystem_group[@id = $group]/url"/>
</xsl:if>
</xsl:variable>
<xsl:if test="total > 0 and limit > 0">
<xsl:variable name="count_pages" select="ceiling(total div limit)"/>
<xsl:variable name="visible_pages" select="5"/>
<xsl:variable name="real_visible_pages"><xsl:choose>
<xsl:when test="$count_pages < $visible_pages"><xsl:value-of select="$count_pages"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$visible_pages"/></xsl:otherwise>
</xsl:choose></xsl:variable>
<!-- Считаем количество выводимых ссылок перед текущим элементом -->
<xsl:variable name="pre_count_page"><xsl:choose>
<xsl:when test="page - (floor($real_visible_pages div 2)) < 0">
<xsl:value-of select="page"/>
</xsl:when>
<xsl:when test="($count_pages - page - 1) < floor($real_visible_pages div 2)">
<xsl:value-of select="$real_visible_pages - ($count_pages - page - 1) - 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="round($real_visible_pages div 2) = $real_visible_pages div 2">
<xsl:value-of select="floor($real_visible_pages div 2) - 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="floor($real_visible_pages div 2)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose></xsl:variable>
<!-- Считаем количество выводимых ссылок после текущего элемента -->
<xsl:variable name="post_count_page"><xsl:choose>
<xsl:when test="0 > page - (floor($real_visible_pages div 2) - 1)">
<xsl:value-of select="$real_visible_pages - page - 1"/>
</xsl:when>
<xsl:when test="($count_pages - page - 1) < floor($real_visible_pages div 2)">
<xsl:value-of select="$real_visible_pages - $pre_count_page - 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$real_visible_pages - $pre_count_page - 1"/>
</xsl:otherwise>
</xsl:choose></xsl:variable>
<xsl:variable name="i"><xsl:choose>
<xsl:when test="page + 1 = $count_pages"><xsl:value-of select="page - $real_visible_pages + 1"/></xsl:when>
<xsl:when test="page - $pre_count_page > 0"><xsl:value-of select="page - $pre_count_page"/></xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose></xsl:variable>
<p>
<xsl:call-template name="for">
<xsl:with-param name="limit" select="limit"/>
<xsl:with-param name="page" select="page"/>
<xsl:with-param name="items_count" select="total"/>
<xsl:with-param name="i" select="$i"/>
<xsl:with-param name="post_count_page" select="$post_count_page"/>
<xsl:with-param name="pre_count_page" select="$pre_count_page"/>
<xsl:with-param name="visible_pages" select="$real_visible_pages"/>
</xsl:call-template>
</p>
<div style="clear: both"></div>
</xsl:if>
</div>
</xsl:if>
<div style="clear: both"></div>
</xsl:template>
<!-- Шаблон выводит рекурсивно ссылки на группы инф. элемента -->
<xsl:template match="informationsystem_group" mode="breadCrumbs">
<xsl:variable name="parent_id" select="parent_id"/>
<xsl:apply-templates select="//informationsystem_group[@id=$parent_id]" mode="breadCrumbs"/>
<xsl:if test="parent_id=0">
<a href="{/informationsystem/url}">
<xsl:value-of disable-output-escaping="yes" select="/informationsystem/name"/>
</a>
</xsl:if>
<span><xsl:text> → </xsl:text></span>
<a href="{url}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
</xsl:template>
<!-- Шаблон выводит ссылки подгруппы информационного элемента -->
<xsl:template match="informationsystem_group" mode="groups">
<li>
<xsl:choose>
<xsl:when test="image_small != ''">
<xsl:value-of disable-output-escaping="yes" select="name"/><br/>
<a href="{url}" title="{name}"><img src="{dir}{image_small}" alt="{name}" /></a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of disable-output-escaping="yes" select="name"/>
<a href="{url}" title="{name}"><img src="/images/no-image.png" alt="{name}" /></a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:template>
<xsl:template match="informationsystem_item">
<div class="col-xs-6 col-sm-6 col-md-3 col-lg-3">
<a href="{dir}{image_large}">
<img src="{dir}{image_small}" title="{name}" class="photogallery-img"/>
</a>
</div>
<xsl:if test="position() mod 4 = 0 and position() != last()">
<xsl:text disable-output-escaping="yes">
</div>
<div class="row">
</xsl:text>
</xsl:if>
</xsl:template>
<!-- /// Метки для информационного элемента /// -->
<xsl:template match="tag">
<a href="{/informationsystem/url}tag/{urlencode}/" class="tag">
<xsl:value-of select="name"/>
</a>
<xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if></xsl:template>
<!-- Цикл для вывода строк ссылок -->
<xsl:template name="for">
<xsl:param name="limit"/>
<xsl:param name="page"/>
<xsl:param name="pre_count_page"/>
<xsl:param name="post_count_page"/>
<xsl:param name="i" select="0"/>
<xsl:param name="items_count"/>
<xsl:param name="visible_pages"/>
<xsl:variable name="n" select="ceiling($items_count div $limit)"/>
<xsl:variable name="start_page"><xsl:choose>
<xsl:when test="$page + 1 = $n"><xsl:value-of select="$page - $visible_pages + 1"/></xsl:when>
<xsl:when test="$page - $pre_count_page > 0"><xsl:value-of select="$page - $pre_count_page"/></xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose></xsl:variable>
<xsl:if test="$i = $start_page and $page != 0">
<span class="ctrl">
← Ctrl
</span>
</xsl:if>
<xsl:if test="$i = ($page + $post_count_page + 1) and $n != ($page+1)">
<span class="ctrl">
Ctrl →
</span>
</xsl:if>
<xsl:if test="$items_count > $limit and ($page + $post_count_page + 1) > $i">
<!-- Заносим в переменную $group идентификатор текущей группы -->
<xsl:variable name="group" select="/informationsystem/group"/>
<!-- Путь для тэга -->
<xsl:variable name="tag_path">
<xsl:choose>
<!-- Если не нулевой уровень -->
<xsl:when test="count(/informationsystem/tag) != 0">tag/<xsl:value-of select="/informationsystem/tag/urlencode"/>/</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Определяем группу для формирования адреса ссылки -->
<xsl:variable name="group_link">
<xsl:choose>
<!-- Если группа не корневая (!=0) -->
<xsl:when test="$group != 0">
<xsl:value-of select="/informationsystem//informationsystem_group[@id=$group]/url"/>
</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise><xsl:value-of select="/informationsystem/url"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Определяем адрес ссылки -->
<xsl:variable name="number_link">
<xsl:choose>
<!-- Если не нулевой уровень -->
<xsl:when test="$i != 0">page-<xsl:value-of select="$i + 1"/>/</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Выводим ссылку на первую страницу -->
<xsl:if test="$page - $pre_count_page > 0 and $i = $start_page">
<a href="{$group_link}{$tag_path}" class="page_link" style="text-decoration: none;">←</a>
</xsl:if>
<!-- Ставим ссылку на страницу-->
<xsl:if test="$i != $page">
<xsl:if test="($page - $pre_count_page) <= $i and $i < $n">
<!-- Выводим ссылки на видимые страницы -->
<a href="{$group_link}{$number_link}{$tag_path}" class="page_link">
<xsl:value-of select="$i + 1"/>
</a>
</xsl:if>
<!-- Выводим ссылку на последнюю страницу -->
<xsl:if test="$i+1 >= ($page + $post_count_page + 1) and $n > ($page + 1 + $post_count_page)">
<!-- Выводим ссылку на последнюю страницу -->
<a href="{$group_link}page-{$n}/{$tag_path}" class="page_link" style="text-decoration: none;">→</a>
</xsl:if>
</xsl:if>
<!-- Ссылка на предыдущую страницу для Ctrl + влево -->
<xsl:if test="$page != 0 and $i = $page">
<xsl:variable name="prev_number_link">
<xsl:choose>
<!-- Если не нулевой уровень -->
<xsl:when test="($page) != 0">page-<xsl:value-of select="$i"/>/</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<a href="{$group_link}{$prev_number_link}{$tag_path}" id="id_prev"></a>
</xsl:if>
<!-- Ссылка на следующую страницу для Ctrl + вправо -->
<xsl:if test="($n - 1) > $page and $i = $page">
<a href="{$group_link}page-{$page+2}/{$tag_path}" id="id_next"></a>
</xsl:if>
<!-- Не ставим ссылку на страницу-->
<xsl:if test="$i = $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="limit" select="$limit"/>
<xsl:with-param name="page" select="$page"/>
<xsl:with-param name="items_count" select="$items_count"/>
<xsl:with-param name="pre_count_page" select="$pre_count_page"/>
<xsl:with-param name="post_count_page" select="$post_count_page"/>
<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>
Вот мой XLS
<?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:template match="/informationsystem">
<!-- Получаем ID родительской группы и записываем в переменную $group -->
<xsl:variable name="group" select="group"/>
<!-- Если в находимся корне - выводим название информационной системы -->
<xsl:if test="group = 0">
<h1>
<xsl:value-of disable-output-escaping="yes" select="name"/>
</h1>
<!-- Описание выводится при отсутствии фильтрации по тэгам -->
<xsl:if test="count(tag) = 0">
<xsl:value-of disable-output-escaping="yes" select="description"/>
</xsl:if>
</xsl:if>
<!-- Если в находимся в группе - выводим название группы -->
<xsl:if test="group != 0">
<h1>
<xsl:value-of disable-output-escaping="yes" select=".//informationsystem_group[@id=$group]/name"/>
</h1>
<!-- Описание выводим только на первой странице -->
<xsl:if test="page = 0">
<xsl:value-of disable-output-escaping="yes" select=".//informationsystem_group[@id=$group]/description"/>
</xsl:if>
</xsl:if>
<!-- Обработка выбранных тэгов -->
<xsl:if test="count(tag) = 1">
<p class="h2">Метка — <strong><xsl:value-of select="tag/name"/></strong>.</p>
</xsl:if>
<!-- Отображение подгрупп данной группы, только если подгруппы есть и не идет фильтра по меткам -->
<xsl:if test="count(tag) = 0 and count(.//informationsystem_group[parent_id=$group]) > 0">
<ul class="polaroids">
<xsl:apply-templates select=".//informationsystem_group[parent_id=$group]" mode="groups"/>
</ul>
</xsl:if>
<xsl:if test="count(informationsystem_item)">
<!-- jQuery lightbox -->
<div id="gallery">
<div class="row">
<xsl:apply-templates select="informationsystem_item" />
</div>
</div>
</xsl:if>
<br class="clearing" />
<!-- Строка ссылок на другие страницы информационной системы -->
<xsl:if test="ОтображатьСсылкиНаСледующиеСтраницы=1">
<div>
<!-- Ссылка, для которой дописываются суффиксы page-XX/ -->
<xsl:variable name="link">
<xsl:value-of select="/informationsystem/url"/>
<xsl:if test="$group != 0">
<xsl:value-of select="/informationsystem//informationsystem_group[@id = $group]/url"/>
</xsl:if>
</xsl:variable>
<xsl:if test="total > 0 and limit > 0">
<xsl:variable name="count_pages" select="ceiling(total div limit)"/>
<xsl:variable name="visible_pages" select="5"/>
<xsl:variable name="real_visible_pages"><xsl:choose>
<xsl:when test="$count_pages < $visible_pages"><xsl:value-of select="$count_pages"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$visible_pages"/></xsl:otherwise>
</xsl:choose></xsl:variable>
<!-- Считаем количество выводимых ссылок перед текущим элементом -->
<xsl:variable name="pre_count_page"><xsl:choose>
<xsl:when test="page - (floor($real_visible_pages div 2)) < 0">
<xsl:value-of select="page"/>
</xsl:when>
<xsl:when test="($count_pages - page - 1) < floor($real_visible_pages div 2)">
<xsl:value-of select="$real_visible_pages - ($count_pages - page - 1) - 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="round($real_visible_pages div 2) = $real_visible_pages div 2">
<xsl:value-of select="floor($real_visible_pages div 2) - 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="floor($real_visible_pages div 2)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose></xsl:variable>
<!-- Считаем количество выводимых ссылок после текущего элемента -->
<xsl:variable name="post_count_page"><xsl:choose>
<xsl:when test="0 > page - (floor($real_visible_pages div 2) - 1)">
<xsl:value-of select="$real_visible_pages - page - 1"/>
</xsl:when>
<xsl:when test="($count_pages - page - 1) < floor($real_visible_pages div 2)">
<xsl:value-of select="$real_visible_pages - $pre_count_page - 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$real_visible_pages - $pre_count_page - 1"/>
</xsl:otherwise>
</xsl:choose></xsl:variable>
<xsl:variable name="i"><xsl:choose>
<xsl:when test="page + 1 = $count_pages"><xsl:value-of select="page - $real_visible_pages + 1"/></xsl:when>
<xsl:when test="page - $pre_count_page > 0"><xsl:value-of select="page - $pre_count_page"/></xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose></xsl:variable>
<p>
<xsl:call-template name="for">
<xsl:with-param name="limit" select="limit"/>
<xsl:with-param name="page" select="page"/>
<xsl:with-param name="items_count" select="total"/>
<xsl:with-param name="i" select="$i"/>
<xsl:with-param name="post_count_page" select="$post_count_page"/>
<xsl:with-param name="pre_count_page" select="$pre_count_page"/>
<xsl:with-param name="visible_pages" select="$real_visible_pages"/>
</xsl:call-template>
</p>
<div style="clear: both"></div>
</xsl:if>
</div>
</xsl:if>
<div style="clear: both"></div>
</xsl:template>
<!-- Шаблон выводит рекурсивно ссылки на группы инф. элемента -->
<xsl:template match="informationsystem_group" mode="breadCrumbs">
<xsl:variable name="parent_id" select="parent_id"/>
<xsl:apply-templates select="//informationsystem_group[@id=$parent_id]" mode="breadCrumbs"/>
<xsl:if test="parent_id=0">
<a href="{/informationsystem/url}">
<xsl:value-of disable-output-escaping="yes" select="/informationsystem/name"/>
</a>
</xsl:if>
<span><xsl:text> → </xsl:text></span>
<a href="{url}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
</xsl:template>
<!-- Шаблон выводит ссылки подгруппы информационного элемента -->
<xsl:template match="informationsystem_group" mode="groups">
<li>
<xsl:choose>
<xsl:when test="image_small != ''">
<xsl:value-of disable-output-escaping="yes" select="name"/><br/>
<a href="{url}" title="{name}"><img src="{dir}{image_small}" alt="{name}" /></a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of disable-output-escaping="yes" select="name"/>
<a href="{url}" title="{name}"><img src="/images/no-image.png" alt="{name}" /></a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:template>
<xsl:template match="informationsystem_item">
<div class="col-xs-6 col-sm-6 col-md-3 col-lg-3">
<a href="{dir}{image_large}">
<img src="{dir}{image_small}" title="{name}" class="photogallery-img"/>
</a>
</div>
<xsl:if test="position() mod 4 = 0 and position() != last()">
<xsl:text disable-output-escaping="yes">
</div>
<div class="row">
</xsl:text>
</xsl:if>
</xsl:template>
<!-- /// Метки для информационного элемента /// -->
<xsl:template match="tag">
<a href="{/informationsystem/url}tag/{urlencode}/" class="tag">
<xsl:value-of select="name"/>
</a>
<xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if></xsl:template>
<!-- Цикл для вывода строк ссылок -->
<xsl:template name="for">
<xsl:param name="limit"/>
<xsl:param name="page"/>
<xsl:param name="pre_count_page"/>
<xsl:param name="post_count_page"/>
<xsl:param name="i" select="0"/>
<xsl:param name="items_count"/>
<xsl:param name="visible_pages"/>
<xsl:variable name="n" select="ceiling($items_count div $limit)"/>
<xsl:variable name="start_page"><xsl:choose>
<xsl:when test="$page + 1 = $n"><xsl:value-of select="$page - $visible_pages + 1"/></xsl:when>
<xsl:when test="$page - $pre_count_page > 0"><xsl:value-of select="$page - $pre_count_page"/></xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose></xsl:variable>
<xsl:if test="$i = $start_page and $page != 0">
<span class="ctrl">
← Ctrl
</span>
</xsl:if>
<xsl:if test="$i = ($page + $post_count_page + 1) and $n != ($page+1)">
<span class="ctrl">
Ctrl →
</span>
</xsl:if>
<xsl:if test="$items_count > $limit and ($page + $post_count_page + 1) > $i">
<!-- Заносим в переменную $group идентификатор текущей группы -->
<xsl:variable name="group" select="/informationsystem/group"/>
<!-- Путь для тэга -->
<xsl:variable name="tag_path">
<xsl:choose>
<!-- Если не нулевой уровень -->
<xsl:when test="count(/informationsystem/tag) != 0">tag/<xsl:value-of select="/informationsystem/tag/urlencode"/>/</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Определяем группу для формирования адреса ссылки -->
<xsl:variable name="group_link">
<xsl:choose>
<!-- Если группа не корневая (!=0) -->
<xsl:when test="$group != 0">
<xsl:value-of select="/informationsystem//informationsystem_group[@id=$group]/url"/>
</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise><xsl:value-of select="/informationsystem/url"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Определяем адрес ссылки -->
<xsl:variable name="number_link">
<xsl:choose>
<!-- Если не нулевой уровень -->
<xsl:when test="$i != 0">page-<xsl:value-of select="$i + 1"/>/</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Выводим ссылку на первую страницу -->
<xsl:if test="$page - $pre_count_page > 0 and $i = $start_page">
<a href="{$group_link}{$tag_path}" class="page_link" style="text-decoration: none;">←</a>
</xsl:if>
<!-- Ставим ссылку на страницу-->
<xsl:if test="$i != $page">
<xsl:if test="($page - $pre_count_page) <= $i and $i < $n">
<!-- Выводим ссылки на видимые страницы -->
<a href="{$group_link}{$number_link}{$tag_path}" class="page_link">
<xsl:value-of select="$i + 1"/>
</a>
</xsl:if>
<!-- Выводим ссылку на последнюю страницу -->
<xsl:if test="$i+1 >= ($page + $post_count_page + 1) and $n > ($page + 1 + $post_count_page)">
<!-- Выводим ссылку на последнюю страницу -->
<a href="{$group_link}page-{$n}/{$tag_path}" class="page_link" style="text-decoration: none;">→</a>
</xsl:if>
</xsl:if>
<!-- Ссылка на предыдущую страницу для Ctrl + влево -->
<xsl:if test="$page != 0 and $i = $page">
<xsl:variable name="prev_number_link">
<xsl:choose>
<!-- Если не нулевой уровень -->
<xsl:when test="($page) != 0">page-<xsl:value-of select="$i"/>/</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<a href="{$group_link}{$prev_number_link}{$tag_path}" id="id_prev"></a>
</xsl:if>
<!-- Ссылка на следующую страницу для Ctrl + вправо -->
<xsl:if test="($n - 1) > $page and $i = $page">
<a href="{$group_link}page-{$page+2}/{$tag_path}" id="id_next"></a>
</xsl:if>
<!-- Не ставим ссылку на страницу-->
<xsl:if test="$i = $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="limit" select="$limit"/>
<xsl:with-param name="page" select="$page"/>
<xsl:with-param name="items_count" select="$items_count"/>
<xsl:with-param name="pre_count_page" select="$pre_count_page"/>
<xsl:with-param name="post_count_page" select="$post_count_page"/>
<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>
Авторизация