parser

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

 

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

Ответ

Nexus 24.10.2002 14:13

=========================== gbook.p ===========================
@CLASS
gbook
@load[admin_mode]
$total[^string:sql{select count(*) from gbook}]
$auth[^auth::load[]]
$admin[^auth.is_logged[]]
@show[per_page;offset]
$nex[^table::sql{select 
	a.id,a.g_name,a.g_email,a.g_text,DATE_FORMAT(a.g_date,'%d.%m.%Y') as date,remote_ip,body 
	from gbook a left join gbook_reply b on a.id=b.id_message order by g_date DESC
	}[$.limit($per_page) $.offset($offset)]]
^nex.menu{^tbl:tab[<a href="mailto:$nex.g_email" class=midhead>$nex.g_name ^if($admin){| $nex.remote_ip}</a> 
^if($admin==1){<a href="reply.html?id=$nex.id">Reply</a>  <a href="?del=$nex.id">Del</a>}
;
$buffer[^taint[html][$nex.g_text]]
$buffer[^buffer.match[\n][g]{<br />}]
$buffer
^if(def $nex.body){
<table width="100%" class="text" cellpadding="0" cellspacing="0">
<tr><td width="65" align="right" valign="top">&nbsp^;</td><td bgcolor="#CDCDCD" valign="top"><b>Ответ :</b>&nbsp^;&nbsp^;</td><td bgcolor="#CDCDCD" valign="top">$nex.body</td></tr>
</table>}
;$nex.date]
}
===============================================================
========================= pager.p ============================
@CLASS
pager
#Usage :  per page ; total pages ; url to post
@load[p_p;whole;post]
$total[$whole]
$per_page[$p_p]
$pages[^math:ceiling($total/$per_page)]
$url[$post]
@show[current]
^if(! def $current){$current[1]}
$offset[^eval(($current-1)*$per_page)]

$result[
<table class=text><tr><td>Страниц : </td>
^for[i](1;$pages){
^if($current==$i){<td><b>[$i]</b> ></td>}{
<td><a href="$url?page=$i">[$i]</a>></td>
}
}
</tr></table>
]
^if($per_page>=$total){$result[]}
@getoffset[]
^if(def $form:page){$page($form:page)}{$page[1]}
$offset[^eval(($page-1)*$per_page)]
$result[$offset]
==============================================================
========================== gbook.html ========================
...

$gb[^gbook::load[$cookie:logged]]
$pag[^pager::load[5;$gb.total;/gbook/]]

^pag.show[$form:page]

^gb.show[$pag.per_page;^pag.getoffset[]]
...
==============================================================
Это guestbook с пагером и ответами.
Если нужен полный код(вставка, удаление и т.д.) можно с просьбой на мыло.