Новости | FAQ | Авторы | Документация | В действии | Библиотека |
Инструменты | Полезные ссылки | Хостинги | Скачать | Примеры | Форум |
Mizter Egoist 14.04.2016 15:58
Заработало, теперь думаю как формировать uri.^void:sql{ INSERT INTO path (anc, dsc) VALUES (LAST_INSERT_ID(), LAST_INSERT_ID()) } ^if(def $form:catalog){ $level[^table::sql{ SELECT anc, dsc, lvl FROM path WHERE 1 = 1 AND anc = 0 AND dsc = $form:catalog }] $lvl($level.lvl + 1) $parent[^table::sql{ SELECT h.dsc, h.lvl, t.anc AS pID, p.* FROM path AS t JOIN pages AS p ON (p.eID = t.anc) LEFT JOIN path AS h ON (h.dsc = t.dsc AND h.anc > 0 AND h.lvl = 1) WHERE t.dsc = $form:catalog ORDER BY pID }] $count[^table::sql{ SELECT COUNT(*) AS count FROM path AS t JOIN pages AS p ON (p.eID = t.anc) LEFT JOIN path AS h ON (h.dsc = t.dsc AND h.anc > 0 AND h.lvl = 1) WHERE t.dsc = $form:catalog }] ^void:sql{ INSERT INTO path (anc, dsc, lvl) VALUES (0, LAST_INSERT_ID(), $lvl) } ^if($parent){ $distance($count.count) ^parent.menu{ ^void:sql{ INSERT INTO path (anc, dsc, lvl) VALUES ($parent.pID, LAST_INSERT_ID(), $distance) } $distance($distance - 1) } } }{ ^void:sql{ INSERT INTO path (anc, dsc, lvl) VALUES (0, LAST_INSERT_ID(), 1) } }