Endi "saytda kim bor" sahifasidan foydalanuvchi qaysi sahifada ekanligini ko'rsatish uchun places.lng faylini qo'lda taxrirlashning hojati yo'q deya bizga
ДоХтор JohnCMS saytida birqancha kodlarni taqdim etdi .
incfiles/classes/functions.php uchun
/**
* Автозапись в файл places.lng местоположения пользователя
*
* @param string $file Локальный путь к файлу
* @param string $headmod Название папки с файлом(файлами)
* @param string $textl Название заголовка страницы
* @param string $uri GET-параметры (если они есть)
*/
public static function headmod($file, $headmod, $textl, $uri = '')
{
$writeToFile = function ($path, $arr, $fname, $uri) {
header('Location: '. $fname . $uri); };
$length = 30 - strlen($headmod);
$url = $headmod .'/'. $fname . $uri;
$href = '='. $repeat .'"<a href=\'#home#/'. $url .'\'>'. $textl .'</a>"';
$places = ROOTPATH .'incfiles/languages/ru/places.lng';
$arrPls,
function ($item) use ($headmod) {
return strstr($item, $headmod); }
);
$arrPls[] = "\r\n". $headmod . str_repeat($spase, $length) . $href;
if (empty($array_result)) { $writeToFile($places, $arrPls, $fname, $uri);
} else {
function ($item) {
preg_match('~(<a[^>]*>).*</a>~ui', $item, $matches); $pattern = '~<a href=\'#home#/[\w\d]+/?([\w\d-]+\.php?.*)\'>~';
},
$array_result
);
in_array($fname . $uri, $arrUri) ?
: $writeToFile($places, $arrPls, $fname, $uri); }
}
]incfiles/classes/functions.php uchun
head.php uchun
<?php
const _IN_JOHNCMS = 1;
$dir = explode(DIRECTORY_SEPARATOR, __DIR__
); $headmod = end($dir); # автоопределение папки $textl = 'Моя страница';
require_once '../incfiles/core.php';
require_once '../incfiles/head.php';
functions::headmod(__FILE__, $headmod, $textl);
/*
Тут код вашей странички
*/
require_once '../incfiles/end.php';
?>
Yoki (agar siz parametrlarni kiritishingiz kerak bo'lsa)
<?php
const _IN_JOHNCMS = 1;
$dir = explode(DIRECTORY_SEPARATOR, __DIR__
); $headmod = end($dir); # автоопределение папки $textl = 'Моя страница с параметрами';
require_once '../incfiles/core.php';
require_once '../incfiles/head.php';
functions::headmod(__FILE__, $headmod, $textl, '?var=value');
/*
Sahifa kodlari
*/
require_once '../incfiles/end.php'