Цитата (Z1dan3 @ 2011-03-18, 6:23)
Приветствую. Всё же хочу узнать, есть или нет в системе возможность менять шаблоны использую запрос через адресную строку вида: site.ru/~skin=default - или что-то в этом роде? Блок смены темы оформления у меня на РС5 отказывается работать. Как быть?
Вот, исправил блок:
<?php
if (!defined('CMS')) die('Попытка взлома?');
#1-вкл кэш, 0-выкл кэш
$mythemes['cache']=1;
#Сюда записываем темы админ панели или те, которые отображать мы не хотим
$mythemes['admin']=array('Audora');
if ($mythemes['cache']==1 && $Mainclass->Cache->Get('block_theme')) $mythemes['list']=unserialize($Mainclass->Cache->Get('block_theme'));
else {
$mythemes['list']=glob($Mainclass->root_path.$Mainclass->Template->theme_path.'/*',GLOB_ONLYDIR);
if ($mythemes['cache']==1) $Mainclass->Cache->Put('block_theme',serialize($mythemes['list']),86400,false);
}
foreach($mythemes['list'] as &$a) {
$mythemes['template']=basename($a);
if (!in_array($mythemes['template'], $mythemes['admin'])) $mythemes['option'][]='<option value="'.$mythemes['template'].'"'.(($mythemes['template']==$Mainclass->Template->theme)?' selected="selected"':'').'>› '.(($mythemes['template']==$Mainclass->Template->theme)?'Текущая: ':'').$mythemes['template'].'</option>';
}
if (count($mythemes['option'])>1) {
$content .='<table align="center"><form name="theme" method="post" action="">';
$content .='<tr><td colspan="2" align="center"><select style="width:150px;" name="theme" size="1" class="select">'.implode($mythemes['option'],'').'</select></td></tr>';
$content .='<tr><td colspan="2" align="center"><input name="save_theme" style="margin-top:5px;" type="submit" value="Изменить тему" /></td></tr></form></table>';
}
?>
ну и конечно в файл:
index.php, тот что в корне не забываем вставить:
if (isset($_POST['theme'])) {$Mainclass->Template->theme=$_POST['theme'];$Mainclass->SCookie('theme',$_POST['theme'],365,true);} elseif ($Mainclass->GCookie('theme')) $Mainclass->Template->theme=$Mainclass->GCookie('theme');
после:
$Mainclass->LoadService();
И ещё заодно вопрос к Александру, можно ли изменить тему оформления без этой вставки в
index.php, что бы весь код был в одном файле блока?