| Новости | FAQ | Авторы | Документация | В действии | Библиотека |
| Инструменты | Полезные ссылки | Хостинги | Скачать | Примеры | Форум |
BeaVe 16.03.2005 09:43 / 16.03.2005 09:46
База данных MySQL@auto[]
$SQL.connect-string[mysql://user:password@server/dbname]
$MAIN:pSQL[^mysql::init[$SQL.connect-string]]
@USE
/classes/lib.p
/classes/mysql.p
/classes/scroller.p
@response[]
$response:Last-Modified[^date::now(-1)]
@header[]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Новости</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<meta name="keywords" content="">
<meta name="description" content="">
</head>
@body[]
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
^base[]
</body>
@footer[]
</html>
@main[]
^MAIN:pSQL.server{
^response[]
^header[]
^body[]
^footer[]
}index.html @base[]
$news[^MAIN:pSQL.sql[table]{
select id, date, title, news
from news
order by id desc
}]
^if($news){
^news.menu{
$str[$news.date]
$date[
$.day[
$.01[1]
$.02[2]
$.03[3]
$.04[4]
$.05[5]
$.06[6]
$.07[7]
$.08[8]
$.09[9]
$.10[10]
$.11[11]
$.12[12]
$.13[13]
$.14[14]
$.15[15]
$.16[16]
$.17[17]
$.18[18]
$.19[19]
$.20[20]
$.21[21]
$.22[22]
$.23[23]
$.24[24]
$.25[25]
$.26[26]
$.27[27]
$.28[28]
$.29[29]
$.30[30]
$.31[31]
]
$.month[
$.01[января]
$.02[февраля]
$.03[марта]
$.04[апреля]
$.05[мая]
$.06[июня]
$.07[июля]
$.08[августа]
$.09[сентября]
$.10[октября]
$.11[ноября]
$.12[декабря]
]
]
<h3>$news.title</h3>
<p>^untaint{$news.news}</p>
<div align="right">^str.match[(\d+)\-(\d+)\-(\d+)][g]{$date.day.[$match.3] $date.month.[$match.2] $match.1 г.}</div>
}[<br><br>]
}{
<h2>Новостей нет!</h2>
}Необходимые классы: