Электронная версия периодического издания «Monitorul Fiscal FISC.md»
Дорогие друзья,
хотим Вам представить нашу разработку электронной версии периодического издания «Monitorul Fiscal FISC.md».
Читать дальше →
Николай
/** * Формирует постраничный вывод * * @param int $iCount Общее количество элементов * @param int $iCurrentPage Текущая страница * @param int $iCountPerPage Количество элементов на одну страницу * @param int $iCountPageLine Количество ссылок на другие страницы * @param string $sBaseUrl Базовый URL, к нему будет добавлять постикс /pageN/ и GET параметры * @param array $aGetParamsList Список GET параметров, которые необходимо передавать при постраничном переходе * @return array */ public function MakePaging($iCount,$iCurrentPage,$iCountPerPage,$iCountPageLine,$sBaseUrl,$aGetParamsList=array()) { if ($iCount==0) { return false; } $iCountPage=ceil($iCount/$iCountPerPage); if (!preg_match("/^[1-9]\d*$/i",$iCurrentPage)) { $iCurrentPage=1; } if ($iCurrentPage>$iCountPage) { $iCurrentPage=$iCountPage; } $aPagesLeft=array(); $iTemp=$iCurrentPage-$iCountPageLine; $iTemp = $iTemp<1 ? 1 : $iTemp; for ($i=$iTemp;$i<$iCurrentPage;$i++) { $aPagesLeft[]=$i; } $aPagesRight=array(); for ($i=$iCurrentPage+1;$i<=$iCurrentPage+$iCountPageLine and $i<=$iCountPage;$i++) { $aPagesRight[]=$i; } $iNextPage = $iCurrentPage<$iCountPage ? $iCurrentPage+1 : false; $iPrevPage = $iCurrentPage>1 ? $iCurrentPage-1 : false; $sGetParams=''; if (is_string($aGetParamsList) or count($aGetParamsList)){ $sGetParams='?'.(is_array($aGetParamsList) ? http_build_query($aGetParamsList,'','&') : $aGetParamsList); } $aPaging=array( 'aPagesLeft' => $aPagesLeft, 'aPagesRight' => $aPagesRight, 'iCount' => $iCount, 'iCountPage' => $iCountPage, 'iCurrentPage' => $iCurrentPage, 'iNextPage' => $iNextPage, 'iPrevPage' => $iPrevPage, 'sBaseUrl' => rtrim($this->Tools_Urlspecialchars($sBaseUrl),'/'), 'sGetParams' => $sGetParams, ); /** * Избавляемся от дублирования страниц с page=1 */ if ($aPaging['iCurrentPage']==1) { $this->SetHtmlCanonical($aPaging['sBaseUrl'].'/'.$aPaging['sGetParams']); } return $aPaging; }
$sText = preg_replace('/<video>http:\/\/(?:www\.|)coub\.com\/view\/(\d+).*<\/video>/i', '<iframe src="http://coub.com/embed/$1?muted=false&autostart=false&originalSize=false&hideTopBar=false&noSiteButtons=false&startWithHD=false" allowfullscreen="true" frameborder="0" width="640" height="480"></iframe>', $sText);
/** * coub.com */ $sText = preg_replace('/<video>http:\/\/(?:www\.|)coub\.com\/view\/(\w+).*<\/video>/i', '<iframe src="http://coub.com/embed/$1?muted=false&autostart=false&originalSize=false&hideTopBar=false&noSiteButtons=false&startWithHD=false" allowfullscreen="true" frameborder="0" width="640" height="480"></iframe>', $sText);
<?php echo date('H:i:s d.m.Y'); ?>тоже выводит правильное время и дату, а вот в топиках беда.
{if !LS::CurUsr() and !Router::GetActionEvent()} {include file='topic_topic.tpl' oTopic=$LS->Topic_GetTopicById(8)} {/if}Да-да, больше ничего не нужно, результат достигнут ;)
/** * Параметры компрессии css-файлов */ $config['compress']['css']['merge'] = true; // указывает на необходимость слияния файлов по указанным блокам. $config['compress']['js']['merge'] = true;
/** * Сжимает все переданные файлы в один, * использует файловое кеширование * * @param array $aFiles Список файлов * @param string $sType Тип файла - js, css * @return array */ protected function Compress($aFiles,$sType) { $sCacheDir = $this->sCacheDir."/".Config::Get('view.skin'); $sCacheName = $sCacheDir."/".md5(serialize($aFiles).'_head').".{$sType}"; $sPathWeb = Config::Get('path.root.web'); /** * Если кеш существует, то берем из кеша */ if(!file_exists($sCacheName)) {
/** * Сжимает все переданные файлы в один, * использует файловое кеширование * * @param array $aFiles Список файлов * @param string $sType Тип файла - js, css * @return array */ protected function Compress($aFiles,$sType) { $sPathWeb = Config::Get('path.root.web'); $aFileDates = array(); $iStart = microtime(true); foreach ($aFiles as $sFile) { // если файл локальный if (strpos($sFile, $sPathWeb)!==false) { $sFile=$this->GetServerPath($sFile); list($sFile,)=explode('?',$sFile,2); $aFileDates[] = filectime($sFile); } } $sCacheDir = $this->sCacheDir."/".Config::Get('view.skin'); $sCacheName = $sCacheDir."/".md5(implode($aFiles).implode($aFileDates).'_head').".{$sType}"; echo "Key calculation took ".(microtime(true) - $iStart)." secs\n"; /** * Если кеш существует, то берем из кеша */ if(!file_exists($sCacheName)) {
Key calculation took 0,0016648769378662 secs Key calculation took 0,0010089874267578 secs