Forum categories

Перенос темы в другой раздел. в селекторе убираем родительские категории, если есть дочерние.


webitproff
webitproff • 2025-07-19 00:09 #1

Перенос темы в другой раздел. в селекторе убираем родительские категории, если есть дочерние.

Все эти лайфхаки придется выполнять повторно при обновлении движка на своем сайте.

после кода:

$jumpbox[cot_url('forums')] = Cot::$L['Forums'];
foreach (Cot::$structure['forums'] as $key => $val)
{
	if (cot_auth('forums', $key, 'R') && strpos($val['path'], '.'))
	{
		($val['tpath'] == $s) || $movebox[$key] = $val['tpath'];
		$jumpbox[cot_url('forums', 'm=topics&s=' . $key, '', true)] = $val['tpath'];
	}
}

 

добавить код:

// Формируем список подкатегорий с отступами вместо родительской
$movebox = [];
foreach (Cot::$structure['forums'] as $key => $val) {
	if (cot_auth('forums', $key, 'R') && strpos($val['path'], '.')) {
		$depth = substr_count($val['path'], '.');
		$indent = str_repeat('› ', $depth); // нормальный визуальный отступ
		$title = $indent . $val['title'];
		($val['tpath'] == $s) || $movebox[$key] = $val['tpath'];
		$jumpbox[cot_url('forums', 'm=topics&s=' . $key, '', true)] = $val['tpath'];
		$movebox[$key] = $title;
	}
}

 

 

This post was edited by webitproff (2025-07-19 00:14, 1 year ago)
2/2/0

webitproff
webitproff • 2025-07-19 01:08 #2

немного криво, но пока и так сойдет 💯

🗿

🧙‍♂️ Well met, good traveler! Fate has guided your steps to our humble realm. Here, wise sages and masters of the coding craft ⚒️📜 gather to unravel the mysteries of the code ✨⚙️, share their knowledge, and add new chapters to our chronicles.
⬅️ To the left lie ancient scrolls 📚 filled with forgotten wisdom. ⬆️ Straight ahead, friendly folk offer counsel 💬 to those in need. ➡️ To the right, you may become a chronicler ✍️ yourself, sharing your craft and leaving words of wisdom for those yet to come.
📝 Delay no longer—tell us the name by which you are known, complete the rite of registration 🛡️, and join our fellowship!
🏰 Our brotherhood holds no secret initiation, yet many halls remain closed to wandering guests, for some knowledge 💎 is reserved for those who choose to walk this path beside us.