groovy - How to store changes to a page in tornado.no/cms? -
in controller page in tornado-cms, following:
def res = service.tornado.articles([ articlecategorypath: "boker/ny"]); service.tornado.loadfullarticles(res); res.sort { a,b -> b.props.year <=> a.props.year } tornado.small_articles = res; or, shorter:
tornado.small_articles = service.tornado.articles([ articlecategorypath: "boker/ny", full: true ]) .sort { a, b -> b.props.year <=> a.props.year }; this fills content box small_articles articles specific folder "boker/ny" reversely sorted article prop year.
it works fine, possible save changes made content box tornado.small_articles resulting list of articles visible gui? service.tornado.savechangestopagecontentbox(page, content_box_nr, tornado.small_articles);?
start removing articles bound small_articles box this:
integer containerid = <id-of-small-articles-container>; service.tornado.getpagebindings(page.id).each { binding -> if (binding.containerid == containerid) service.tornado.deletepagebinding(binding); } then add new bindings articles have collected:
tornado.small_articles.each { service.tornado.addpagebinding(new articlepagecontainer(page.id, it.id, containerid)); } you should not on every request given page, rather update list when content changes or other, less frequent criteria.
Comments
Post a Comment