Новости | FAQ | Авторы | Документация | В действии | Библиотека |
Инструменты | Полезные ссылки | Хостинги | Скачать | Примеры | Форум |
BeaVe 02.08.2005 13:47
Не могу разобраться с Вашим примером... :-(@getMessagesByParent[category_parent_id;limit] $result[^table::sql{ SELECT categories.category_id AS id, category_parent_id, category_type, name, title, date_published, is_published FROM categories WHERE ^if(def $category_parent_id){category_parent_id = ^category_parent_id.int(0) AND} is_published = 1 ORDER BY date_published }[^if(^limit.int(0)){$.limit(^limit.int(0))}]] @getMessagesByThread[thread] $result[^table::sql{ SELECT categories.category_id AS id, category_parent_id, category_type, name, title, date_published, is_published FROM categories WHERE ^if($thread is table){ ^if($thread){category_type IN (^thread.menu{$thread.category_type}[,]) AND} }{ category_type = ^thread.int(0) AND } is_published = 1 ORDER BY date_published DESC }] @printMessagesByParent[categories;category_parent_id][levelcategories] $levelcategories[^categories.select($categories.category_parent_id == $category_parent_id)] ^levelcategories.menu{ ^printTreeItem[$levelcategories.fields;^printMessagesByParent[$categories;$levelcategories.forum_message_id]] } @printTreeItem[category;body] $result[<input type="checkbox" name="categories" value="$category.id">$category.title [$category.id]<br> ^if(def $body){<ul>$body</ul>}] @printMessagesByParent[category_parent_id][levelcategories] ^if($hashTree.[$category_parent_id]){ $levelcategories[$hashTree.[$category_parent_id]] ^levelcategories.menu{ ^printTreeItem[$levelcategories.fields;^if($hashTree.[$levelcategories.id]){^printMessagesByParent[$levelcategories.id]}] } } @createHashTree[categories] $result[^categories.hash[category_parent_id][$.distinct[tables]]] @printMessageUrl[parent_id;uri][message] ^if(^parent_id.int(0)){ $message[^getMessagesByParent[$parent_id]] ^printMessageUrl[$category.parent_id;$parent_id^if(def $uri){/$uri}] }{ $result[/uri/] } @main[] ^MAIN:pSQL.server{ $rootMessages[^getMessagesByParent[]] $categories[^getMessagesByThread[$rootMessages]] $hashTree[^createHashTree[$categories]] ^printMessagesByParent[0] # тестирую printMessageUrl ^printMessageUrl[6] }