ndr Posted September 29, 2014 Share Posted September 29, 2014 Здравствуйте! Мне нужно вывести статистику форума в подвал форума, чтобы она располагалась не в рамках контента, а в подвале по всей ширине страницы. Однако переменные статистики не передаются в шаблон globalTemplate, они выводятся в шаблоне boardindexTemplate. Подскажите, как передать переменную $stat в шаблон global? Link to comment Share on other sites More sharing options...
siv1987 Posted September 29, 2014 Share Posted September 29, 2014 Переменные не только передаются только в шаблоне boardindexTemplate, но и генерируются только при вызове этого шаблона. А так как этот шаблон вызывается только на главной странице, то и доступны они будут в рамках этой страницы. А вообще статистика хранится кеш, получить ее можно из кеша: $stats = $this->caches['stats'];или$stats = $this->cache->getCache('stats'); 1 Link to comment Share on other sites More sharing options...
ndr Posted September 29, 2014 Author Share Posted September 29, 2014 Переменные не только передаются только в шаблоне boardindexTemplate, но и генерируются только при вызове этого шаблона. А так как этот шаблон вызывается только на главной странице, то и доступны они будут в рамках этой страницы. А вообще статистика хранится кеш, получить ее можно из кеша: $stats = $this->caches['stats'];или$stats = $this->cache->getCache('stats'); Большое спасибо! Попробую. Link to comment Share on other sites More sharing options...
ndr Posted September 29, 2014 Author Share Posted September 29, 2014 (edited) Вот такой хук:<?php class footerStats { protected $registry; protected $stats; protected $cache; public function __construct() { /* Make registry objects */ $this->registry = ipsRegistry::instance(); $this->cache = $this->registry->cache(); $this->stats = $this->cache->getCache('stats'); } public function getOutput() { /* Return */ $n=""; foreach ($this->stats as $s){ $n .=$s; } return $n; } } Работает) Спасибо большое! Только вот статистика там не та что нужно, нет пользователей онлайн( Edited September 29, 2014 by ndr Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now