if (! file_exists(WB_PATH . '/modules/cwsoft-anynews/droplet/cwsoft-anynews-droplet.php')) return;include(WB_PATH . '/modules/cwsoft-anynews/droplet/cwsoft-anynews-droplet.php');return $output;
it seems that the section_id, group_id does not work.
$config = array( 'group_id' => 8, 'group_id_type' => 'section_id',);
Thanks for the help, it works now.
if (function_exists('getNewsItems')) { echo getNewsItems();}
$max_news_length = 30,$display_mode = 3,
Can one code section also pass parameters?
if (function_exists('getNewsItems')) { echo getNewsItems(array( 'max_news_length' => 30, 'display_mode' => 3, ));}
if (function_exists('getNewsItems')) { $options = array( 'max_news_length' => 30, 'display_mode' => 3, ); echo getNewsItems($options);}
I chose option 2. It now works as it should.
[[getNewsItems?group_id=27&max_news_items=5&max_news_length=80&display_mode=50¬_older_than=360&group_id_type='section_id']]
[[getNewsItems?group_id=9&max_news_items=5&max_news_length=80&display_mode=50¬_older_than=360&group_id_type='page_id']]
It seems the section_id and page_id parameters don't work. I have this droplet, which should show the news from news section ID 27, but instead it shows the "no news available" line.Code: [Select][[getNewsItems?group_id=27&group_id_type='section_id']]
[[getNewsItems?group_id=27&group_id_type='section_id']]
[[getNewsItems?group_id=27&group_id_type=section_id]]
And also the regular code calls don't seem to work with page_id and section_id...
@argos: Date formats can be defined via Twig date function and a modified Anynews template. If default date filters provided by Twig are not sufficient for you, one can code it's own Twig function or extension to transform whatever is needed.
{% for news in newsItems %} <div class="twig_block"> <div class="twig_date"> <div class="twig_day">{{news.PUBLISHED_WHEN|date("j")}}</div> <div class="twig_month">{{news.PUBLISHED_WHEN|date("M")}}</div> </div> <div class="twig_title"><a href="{{news.LINK}}">{{news.TITLE }}</a></div></div>{% endfor %}
.twig_block {display:block;clear:both;width:100%;margin-bottom:10px;min-height:50px;overflow:auto;}.twig_date {width:20%;min-width:35px;float:left;}.twig_date .twig_day {background:#a8d591;color:#333;font-weight:bold;text-align:center;font-size:110%;border-radius:4px 4px 0 0;}.twig_date .twig_month {background:#5c9d3b;color:#fff;text-align:center;border-radius:0 0 4px 4px;font-size:70%;text-transform:uppercase;}.twig_title {float:right;width:75%;margin-top:-2px;}
I almost got it, except that the month is in English, and doesn't follow the locale set in the admin. How can I change that?
Doesn't this Twig stuff just add a big layer of complexity to this snippet?
find fixed code below
Thanks marmot. It doesn't work however.
{% set germanmonth = ["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"] %}{% for news in newsItems %} <div class="twig_block"> <div class="twig_date"> <div class="twig_day">{{news.PUBLISHED_WHEN|date("j")}}</div> <div class="twig_month">{{germanmonth[news.PUBLISHED_WHEN|date("m")]}}</div> </div> <div class="twig_title"><a href="{{news.LINK}}">{{news.TITLE }}</a></div></div>{% endfor %}