parser

Написать ответ на текущее сообщение

 

 
   команды управления поиском

Тут сделано так:

Misha v.3 10.08.2002 14:48

###########################################################################
@searchInForum[terms;author;searchInMessage][tmp]
$tmp[${terms}${author}]
$result[^table::sql{
	SELECT
		forum_message_id,
		${tblPrefix}forum_message.forum_message_body_id AS is_not_empty,
		name,
		author,
		^MAIN:pSQL.date_format[${tblPrefix}forum_message.dt_published;%d.%m %H:%i] AS date,
		IF(${tblPrefix}forum_message.dt_published >= ^MAIN:pSQL.today[], 1, 0) AS new,
		dt_published
	FROM 
		${tblPrefix}forum_message
		^if(^searchInMessage.int(0)){LEFT JOIN ${tblPrefix}forum_message_body ON (${tblPrefix}forum_message.forum_message_body_id = ${tblPrefix}forum_message_body.forum_message_body_id)}
	WHERE
		${tblPrefix}forum_message.is_published = 1 AND
		${tblPrefix}forum_message.forum_id = $forumId AND
		^if(def $terms){
			(
				name LIKE '%$terms%'
				^if(^searchInMessage.int(0)){OR message LIKE '%$terms%'}
			) AND
		}
		^if(def $author){
			^MAIN:pSQL.lower[author] = '$author' AND
		}
		1
	ORDER BY 
		${tblPrefix}forum_message.dt_published DESC, 
		${tblPrefix}forum_message.forum_message_id DESC
}[^if(!def $tmp){$.limit(10)}]]
#end @searchInForum[]