Обновлена логика центральных блоков: теперь поддерживается несколько блоков
This commit is contained in:
17
index.php
17
index.php
@@ -7,7 +7,7 @@
|
||||
/** @brief Путь к текущей директории */
|
||||
$path = dirname(__FILE__) . '/';
|
||||
|
||||
/* if(isset($_SESSION)) { file_put_contents($path . '/error.txt', "" . PHP_EOL, FILE_APPEND); }*/
|
||||
/* file_put_contents($path . '/error.txt', "" . PHP_EOL, FILE_APPEND); */
|
||||
|
||||
session_start();
|
||||
|
||||
@@ -150,7 +150,7 @@ if ($access) {
|
||||
$config['right'] = "<div id='right-float'>" . $config['right'] . "</div>";
|
||||
|
||||
$center = '<div class="center-float">' . GetBlock($xmlstr->cblock->block, 'center') . '<div>';
|
||||
$config['content'] = $xmlstr->content->{$config['lng']};
|
||||
/* $config['content'] = $xmlstr->content->{$config['lng']}; */
|
||||
} else {
|
||||
if ($_SESSION['log_in']) {
|
||||
$xmlstr = simplexml_load_file($path . 'content/adm/user.page.php');
|
||||
@@ -161,7 +161,18 @@ if ($access) {
|
||||
$config['left'] = '';
|
||||
$config['right'] = '';
|
||||
$center = '<div class="center-float">' . GetBlock($xmlstr->cblock->block, 'center') . '<div>';
|
||||
$config['content'] = $xmlstr->content->$config['lng'];
|
||||
/* $config['content'] = $xmlstr->content->{$config['lng']}; */
|
||||
}
|
||||
|
||||
$xmlString = file_get_contents($path . $config['page_url'] . ".page.php");
|
||||
preg_match('#<' . $config['lng'] . '>(.*?)</' . $config['lng'] . '>#s', $xmlString, $tagMatch);
|
||||
$config['content'] = '';
|
||||
if (preg_match_all('#<!\[CDATA\[(.*?)\]\]>#s', $tagMatch[1], $matches)) {
|
||||
foreach ($matches[1] as $i => $cdata) {
|
||||
if ($i > 0)
|
||||
$config['content'] .= "<br>";
|
||||
$config['content'] .= '<div class="%cfloat%' . ($i == 0 ? ' content1' : '') . '"><div class="content">' . $cdata . '</div></div>';
|
||||
}
|
||||
}
|
||||
foreach ($config as $key=>$value) if ($key!="request_url")
|
||||
$config['content'] =str_replace('%'.$key.'%', $value, $config['content']);
|
||||
|
||||
Reference in New Issue
Block a user