16
Шаблоны XSLT / Как узнать какой из разделов каталога активен?
« : 19 Ноября 2011, 19:43:44 »
Не получается определить активный раздел каталога, делал во так.
Добавил в _custom.php
В шаблоне пытаюсь получить значение, но получаю пустую страницу на выходе.
<xsl:variable name="is_active" select="document(concat('udata://custom/is_active/', @id, '/xslt'))/udata" />
Помогите пожалуйста, в какую сторону смотреть?
Добавил в _custom.php
Код: [Выделить]
public function is_active($page_id, $mode = 'tpl'){
$currentPageId = cmsController::getInstance()->getCurrentElementId();
if($currentPageId){
static $allParentsIds = null;
if(is_null($allParentsIds)) {
$allParentsIds = umiHierarchy::getInstance()->getAllParents($currentPageId, true);
}
$page_id = (int) $page_id;
$result = in_array($page_id, $allParentsIds) ? true : false;
}else $result = false;
switch ($mode){
case 'tpl':
if($result) return 'active';
break;
case 'xslt':
if($result) return 1;
else return 0;
break;
}
}
В шаблоне пытаюсь получить значение, но получаю пустую страницу на выходе.
<xsl:variable name="is_active" select="document(concat('udata://custom/is_active/', @id, '/xslt'))/udata" />
Помогите пожалуйста, в какую сторону смотреть?