From 575341067cba8c482298afe733354662ff145c0f Mon Sep 17 00:00:00 2001 From: Alexey Kachayev Date: Tue, 19 Jan 2010 17:38:04 +0000 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=B5=D0=BD=D1=8E:=20=D1=8D=D0=BA?= =?UTF-8?q?=D1=81=D0=BF=D0=B5=D1=80=D0=B8=D0=BC=D0=B5=D0=BD=D1=82=D0=B0?= =?UTF-8?q?=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20=D0=B2=D0=B0=D1=80=D0=B8=D0=B0?= =?UTF-8?q?=D0=BD=D1=82.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/modules/viewer/Viewer.class.php | 43 +++++++++++++++++++++++++- templates/skin/new/header_nav.tpl | 2 +- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/engine/modules/viewer/Viewer.class.php b/engine/modules/viewer/Viewer.class.php index ab7206f4..a3790a11 100644 --- a/engine/modules/viewer/Viewer.class.php +++ b/engine/modules/viewer/Viewer.class.php @@ -148,6 +148,18 @@ class LsViewer extends Module { * @var unknown_type */ protected $sResponseAjax=null; + /** + * Список меню для рендеринга + * + * @var array + */ + protected $aMenu=array(); + /** + * Скомпилированные меню + * + * @var array + */ + protected $aMenuFetch=array(); /** * Инициализация модуля * @@ -241,6 +253,11 @@ class LsViewer extends Module { * Загружаем в шаблон блоки */ $this->Assign("aBlocks",$this->aBlocks); + /** + * Загружаем содержимое menu-контейнеров + */ + $this->Assign("aMenuFetch",$this->aMenuFetch); + $this->Assign("aMenuContainers",array_keys($this->aMenu)); /** * Загружаем HTML заголовки */ @@ -1120,7 +1137,27 @@ class LsViewer extends Module { ); return $aPaging; } - + + /** + * Добавить меню в контейнер + * + * @param string $sContainer + * @param string $sTemplatePath + */ + public function AddMenu($sContainer, $sTemplate) { + $this->aMenu[strtolower($sContainer)]=$sTemplate; + } + /** + * Компилирует меню по контейнерам + * + * @return null + */ + protected function BuildMenu() { + foreach ($this->aMenu as $sContainer=>$sTemplate) { + $this->aMenuFetch[$sContainer]=$this->Fetch($sTemplate); + } + } + /** * Загружаем переменные в шаблон при завершении модуля * @@ -1130,6 +1167,10 @@ class LsViewer extends Module { * Добавляем блоки по предзагруженным правилам */ $this->BuildBlocks(); + /** + * Рендерим меню для шаблонов + */ + $this->BuildMenu(); /** * Добавляем JS и CSS по предписанным правилам */ diff --git a/templates/skin/new/header_nav.tpl b/templates/skin/new/header_nav.tpl index 63f4a656..9e0db708 100644 --- a/templates/skin/new/header_nav.tpl +++ b/templates/skin/new/header_nav.tpl @@ -10,7 +10,7 @@ {/if} {if $menu} - {include file=menu.$menu.tpl} + {if in_array($menu,$aMenuContainers)}{$aMenuFetch.$menu}{else}{include file=menu.$menu.tpl}{/if} {/if}