DLE расширение тега custom новыми параметрами


Представляем хак DLE 9.x - 10.x расширение тега custom новыми параметрами, чтобы добавить возможности для вывода новостей через custom по сортировке тегов, доп. полей, количества просмотров, рейтинга, количества комментариев, по дате самой новости и т.д. К примеру вы можете применить такую конструкцию {custom comm_more="14" comm_less="26"}, чтобы выводить новости с интервалом комментариев от 15 до 25 и т.д., ниже даются несколько десятков примеров.
Эти конструкции корректно будут хорошо отображается на главной странице

Установка хака DLE расширение тега custom новыми параметрами
Открыть /engine/modules/functions.php найти :

if( preg_match( "#category=['"](.+?)['"]#i", $param_str, $match ) ) {


Выше вставить :

if( preg_match( "#tags=['"](.+?)['"]#i", $param_str, $match ) ) {
		$match[1] = explode (',', $match[1]);
		$match[1] = implode (',', $match[1]);
		$match[1] = str_replace(',', '|', $match[1]);
		$where[] = "tags regexp '[[:<:]](".$match[1].")[[:>:]]'";
	}
	
	if( preg_match( "#xfield=['"](.+?)['"]#i", $param_str, $match ) ) {
		$match[1] = explode (',', $match[1]);
		$match[1] = implode (',', $match[1]);
		$match[1] = str_replace(',', '|', $match[1]);
		$where[] = "xfields regexp '[[:<:]](".$match[1].")[[:>:]]'";
	}
	
	if( preg_match( "#comm_more=['"](.+?)['"]#i", $param_str, $match ) ) {
		$match[1] = (int)$match[1];
		$where[] = "comm_num > " . $match[1];
	}
	
	if( preg_match( "#comm_less=['"](.+?)['"]#i", $param_str, $match ) ) {
		$match[1] = (int)$match[1];
		$where[] = "comm_num < " . $match[1] ;
	}
	
	if( preg_match( "#comm_equally=['"](.+?)['"]#i", $param_str, $match ) ) {
		$match[1] = (int)$match[1];
		$where[] = "comm_num = " . $match[1];
	}
	
	if( preg_match( "#date=['"](.+?)['"]#i", $param_str, $match ) ) {
		$match[1] = (int)$match[1];
		$where[] = "date LIKE '".$match[1]."%'";
	}
	
	if( preg_match( "#read_more=['"](.+?)['"]#i", $param_str, $match ) ) {
		$match[1] = (int)$match[1];
		$where[] = "news_read > " . $match[1];
	}
	
	if( preg_match( "#read_less=['"](.+?)['"]#i", $param_str, $match ) ) {
		$match[1] = (int)$match[1];
		$where[] = "news_read < " . $match[1];
	}
	
	if( preg_match( "#read_equally=['"](.+?)['"]#i", $param_str, $match ) ) {
		$match[1] = (int)$match[1];
		$where[] = "news_read = " . $match[1];
	}
	
	if( preg_match( "#rating_more=['"](.+?)['"]#i", $param_str, $match ) ) {
		$match[1] = (int)$match[1];
		$where[] = "rating > " . $match[1];
	}
	
	if( preg_match( "#rating_less=['"](.+?)['"]#i", $param_str, $match ) ) {
		$match[1] = (int)$match[1];
		$where[] = "rating < " . $match[1];
	}
	
	if( preg_match( "#rating_equally=['"](.+?)['"]#i", $param_str, $match ) ) {
		$match[1] = (int)$match[1];
		$where[] = "rating = " . $match[1];
	}


Все...



Автор: Gameer

Закачать dle хаки с нашего портала, как хак расширяем тег custom новыми параметрами

DLE-rasshirenie-tega-custom-novymi-parametrami.rar [88,04 Kb] (cкачиваний: 70)
{rating-num}0

Комментарии (0)

Оставить комментарий

Кликните на изображение чтобы обновить код, если он неразборчив