protected function SetTemplateInclude($sTemplate) { list($sPlugin, $sAction) = explode('_', get_class($this), 2); $sPath = HelperPlugin::GetPluginPath() . '/templates/skin/'; if (is_dir($sPath . Config::Get('view.skin'))) { $sPath .= Config::Get('view.skin'); } elseif (is_dir($sPath . 'admin_default')) { $sPath .= 'admin_default'; } elseif (is_dir($sPath . 'default')) { $sPath .= 'default'; } else { $sPath = ''; } if ($sPath) { $sTemplate = $sPath . '/actions/ActionAdmin/' . $sTemplate . '.tpl'; } else { $sTemplate = Plugin::GetTemplatePath($this->sPluginAddon) . 'actions/' . $sAction . '/' . $sTemplate . '.tpl'; } $sTemplate = ACE::LocalPath($sTemplate, ACE::GetPluginsDir()); //var_dump($s);exit; $this->Viewer_Assign('include_tpl', $sTemplate); }
/** * Рекурсивное создание папки (если ее нет) * * @static * * @param $sNewDir * @param int $nMode * @param bool $bQuiet * * @return bool|string */ static function MakeDir($sNewDir, $nMode = 0755, $bQuiet = false) { $sBasePath = ACE::FilePath(self::GetRootDir() . '/'); if (substr($sNewDir, 0, 2) == '//') { $sNewDir = substr($sNewDir, 2); } else { $sNewDir = ACE::LocalPath($sNewDir, $sBasePath); } $sTempPath = $sBasePath; $aNewDir = explode('/', $sNewDir); foreach ($aNewDir as $sDir) { if ($sDir != '.' and $sDir != '') { $sCheckPath = $sTempPath . $sDir . '/'; if (!is_dir($sCheckPath)) { if ($bQuiet) { $bResult = @mkdir($sCheckPath, $nMode, true); } else { $bResult = mkdir($sCheckPath, $nMode, true); } if ($bResult) { //; } else { //die('Cannot make dir "' . $sCheckPath . '"'); return false; } if ($bQuiet) { @chmod($sCheckPath, $nMode); } else { chmod($sCheckPath, $nMode); } } $sTempPath = $sCheckPath; } } return $sTempPath; }
protected function _checkSkinDir() { if (!is_dir(Config::Get('path.smarty.template'))) { die('The skin folder "' . ACE::LocalPath(Config::Get('path.smarty.template'), ACE::GetRootDir()) . '" does not exist'); } }
public function Call() { if ($this->SourceTypeIsTemplate()) { // получаем пути к шаблонам $aTplDirs = $this->GetSmarty()->getTemplateDir(); $sTemplate = $this->GetContentSource(); $sFile = ''; // лежит ли подгружаемый шаблон по одному из путей foreach ($aTplDirs as $sDir) { if (ACE::LocalPath(dirname($sTemplate), $sDir) and ACE::FileExists($sTemplate)) { $sFile = $sTemplate; break; } } if (!$sFile) { // варианты расположения шаблона foreach ($aTplDirs as $sDir) { if (ACE::FileExists($sDir . '/' . $sTemplate)) { $sFile = ACE::FilePath($sDir . '/' . $sTemplate); } } } if (!$sFile) { $sFile = $sTemplate; } $sResult = file_get_contents($sFile); } elseif ($this->SourceTypeIsCallback()) { $sResult = call_user_func_array($this->GetContentSource(), array()); } else { $sResult = $this->GetContentSource(); } return $sResult; }