Code snippet to display news from the news module at any page you want.
- Download anynews.zip from the addons repository and install it via the Website Baker backend > Add-ons > Modules
- invoke the new function displayNewsItems() from a page/section of type code or the template index.php file
Copy the code below to a page or section of type code:
displayNewsItems($group_id, $max_news_items, $max_news_length, $display_mode, $lang_id, $strip_tags, $allowed_tags, $custom_placeholder, $sort_by, $sort_order, $not_older_than);
or...
add the following code to the index.php file of your template:
<?php
displayNewsItems($group_id, $max_news_items, $max_news_length, $display_mode, $lang_id, $strip_tags, $allowed_tags, $custom_placeholder, $sort_by, $sort_order, $not_older_than);
?>
You can customize the output of "Anynews" via several optional parameters to the function displayNewsItems().
- group_id...
group to show news from (default:= 0 all groups, X:= group X, for multiple groups: array(2,4,5) ) - max_news_items...
maximal number of news shown (default:= 10, min:=1, max:= 999) - max_news_length...
maximal length of the short news text shown (default:=-1 for full news length) - display_mode...
1:=details (default); 2:=unsorted list; 3:=coda slider; 4-99 (custom template: custom_output_display_mode_X.htt) - lang_id...
module language file ID (default:= auto, examples: auto, DE, EN) - strip_tags...
true:=remove all tags not allowed via variable $allowed_tags (default:=true); false:=don´t strip tags - allowed_tags...
allowed tags (default:='<p><a><img>')
custom_placeholder false:= none (default), array('MY_VAR_1' => '%TAG%', ... 'MY_VAR_N' => '#regex_N#' ...) - sort_by...
1:=position (default), 2:=posted_when, 3:=published_when, 4:= random order - sort_order...
1:=descending (default), 2:=ascending - not_older_than..
0:=disabled (default), 0-999 (only show news `published_when` date <=x days; 12 hours:=0.5)


