Новости | FAQ | Авторы | Документация | В действии | Библиотека |
Инструменты | Полезные ссылки | Хостинги | Скачать | Примеры | Форум |
Step 04.01.2005 10:52
Я вот не понимаю что не так? Парсеру не нравятся вот эти строки:y_hash[^calendar.hash[year;year][$distinct(1)]] $ym_hash[^calendar.hash{^calendar.year.format[%04d]=^calendar.month.format[%02d]}[month] [$.distinct(1)]]Выдает такую ошибку:
################_ìåòîä_ïîëó÷åíèÿ_ñòàòåé_ïî_çàäàííûì_òåìàì#################### @getnews[lparams][params] $params[^hash::create[$lparams]] $result[^MAIN:pSQL.sql[table]]{ SELECT article_id AS id, title, lead, dt ^if(^params.id.int(0)){, body} FROM news WHERE article_type_id=^params.article_type_id.int(0) AND is_published=1 AND dt_published<=^MAIN:pSQL.now[] ^if(^params.id.int(0)){ AND article_id=^params.id.int(0) } ^if(def $params.where){ AND $params.where } ORDER BY dt DESC }[ ^if(def $params.limit){$limit($params.limit)} ^if(def $params.offset){$offset($params.offset)} ] #########################_end_of_this_geting_news_########################### ############################################################################# #####################_îòîáðàæåíèå_ñïèñêà_àíîíñîâ_íîâîñòåé_################### @printnews[news] <ul> ^untaint[as-is]{ ^news.menu{ <li><b>^dtf:format[%d%m%Y;$news.dt]</b> ^printTitle[$news] <br />$news.lead</li> } } </ul> #########################_end_of_this_geting_lead_########################### ############################################################################# ###################_Îòîáðàæåíèå_îäíîé_ñòàòüè_ñ_òåêñòîì_###################### @get_one_news[news] ^untaint[as-is]{ ^if(def $news.title){<h1>^news.title.match[[/[/]]][g]{}</h1>} ^dtf:format[%d%m%Y;$news.dt;$dtf:rr-locate] <p>$news.body</p> } #########################_êîíåö_âûâîäà_îäíîé_íîâîñòè_####################### ############################################################################ ############_äîñòàåì_èíôîðìàöèþ_äëÿ_îòîþðàäåíèÿ_êàëåíäàðÿ_################## @getCalendar[lparams][params] $params[^hash::create[$lparams]] $result[^MAIN:pSQL.sql[table]{ SELECT ^MAIN:pSQL.month[dt] AS month, ^MAIN:pSQL.year[dt] AS year FROM news WHERE article_type_id=^params.article_type_id.int(0) AND is_published=1 AND dt_published<=^MAIN:pSQL.now[] GROUP BY year, month }] #################_êîíåö_ñêðèïòà_############################################ ############################################################################ #################_îòîáðàæåíèå_êàëåíäàðÿ_#################################### @printCalendar[calendar][now;curr_year;curr_month;y_hash;ym_hash;i;m] ^if($calendar){ $now[^date::now[]] $curr_year(^form:year.int(^dtf:format[%Y])) $curr_month(^form:month.int(^dtf:format[%m])) $y_hash[^calendar.hash[year;year][$distinct(1)]] $ym_hash[^calendar.hash{^calendar.year.format[%04d]=^calendar.month.format[%02d]}[month] [$.distinct(1)]] $year[^y_hash._key[]] ^year.sort($year.key)[desc] <table border="1" align="right"> <tr valign="top"> <td> ^year.menu{ <b>^if($year.key==$curr_year){ $year.key / ^; }{ ^rem{ *** åñëè êëèêíåì â ãîä, ïî ïîïàäåì íà ïîñëåäíèé ìåñÿö ãîäà, çà êîòîðûé ó íàñ åñòü íîâîñòè *** } ^if(^calendar.locate[year;$year.key]){} <a href="?year=?year.key&month=$calendar.month">$year.key</a> } </b><br /> } </td> <td> ^if(^year.locate[key;$curr_year]){} ^for[i](0;11){ $m(12-$i) ^if(def $form:month && $m==$curr_month){ <b>$dtf:[ri-locate].month.$m</b><br /> }{ ^if(!($now.year==$curr_year && $m>$now.month)){ ^if($ym_hash.[^curr_year.format[%04d]=^m.format[%02d]]){ <a href="?year=$curr_year&month=$m">$dtf:[ri-locate].month.$m</a> }{ $dtf:[ri-locate].month.$m } <br /> } } } </td> </tr> </table> }И файд index.html:
@greeting[] Ñòðàíèöà íîâîñòåé, çàõîäèòå ÷àùå! @body_additional[] <center>Àðõèâ íîâîñòåé çà òåêóùèé ìåñÿö:</center> <br> @body_main[] ^if(!def $form:id){ $calendar[^printCalendar[$.article_type_id(1)]] ^printCalendar[$calendar] ###################### $news[^getnews[ $.article_type_id(1) ^if(^form:year.int(0)){ $.where[dt>='^form:year.int(0)-^form:month.int(0)-00' AND dt<='^form:year.int(0)-^form:year.int(0)-31'] }{ $limit(20) } ] ] ####################### ^if($news){ ^printnews[$news] }{ <p>Íå íàéäåíî íè÷åãî çà óêàçàííûé ïåðèîä</p> } ###################### }{ $news[^getnews[ $.article_type_id(1) $.id(^form:id.int(0)) ]] ^if($news){ ^print_one_news[$news] }{ ^location[/404/] } }Подскажите!