WebsiteBaker Support (2.8.x) > Droplets & Snippets
Snippet: cwsoft-anynews
jacobi22:
the code from dbs is part of the twig-version -> {{ news.GROUP_IMAGE }}, see the double brackets here. your version is older and use phplib. twig and phplib are "translators" for the placeholders and different methodes, not possible, to mix it. phplib use a single brackets like {} or [] around a placeholders. the most templates in the wb-backend using phplib, newer modules like new wrapper, mod_multilingual using twig
in attachement a older version of anynews, the latest before cwsoft stops this project here. is has twig as thirthparty onboard, so its possible to run in older wb-versions without twig in the package.
twig is now part of wb since SP4 (?)
in this version i use another parameter called start_item. thia parameter make it possible, to start the output somewher in the loop of the news. for example: a first standard function call show's the first 5 elements of the news, in a second call, i use the start_item-parameter with the value == 6, it means: show me the X next elements, but start at element number 6.
here some examples code for the output, using in a project in different sections, first call run's in a slider and shows only special news for this slider
at first a standard call
show all item from group = 2, in display_mode = 4, order=descending, max lenght = 170 chars
--- Code: ---[[getNewsItems?group_id=2&display_mode=4&max_news_items=999&sort_by=1&sort_order=1&max_news_length=170&allowed_tags=<p><a><img><strong>]]
--- End code ---
after a wysiwyg section, a block with only 4 news in a teaser line
next a limit of 4
show only 4 news from group 1
--- Code: ---[[getNewsItems?group_id=1&display_mode=5&max_news_items=4&sort_by=1&sort_order=1&start_item=0¬_older_than=999&max_news_length=150]]
--- End code ---
after a grafic element, i need some more news in a second teaser block
the example with the start item
show maximal two news from group_id = 1, start with number 4
--- Code: ---[[getNewsItems?group_id=1&display_mode=5&max_news_items=2&sort_by=1&sort_order=1&start_item=4¬_older_than=999&max_news_length=150]]
--- End code ---
rumen:
I did it with the old ver. Somehow I could make it with some formating, group picture (all posts will use one and the same, but ...) . It is not exactly as I wished, but it is ok!
Will look something like that:
Thanks for the help!
Navigation
[0] Message Index
[*] Previous page
Go to full version