WebsiteBaker 2.13.8 is now available!
R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WBhttps://forum.websitebaker.org/index.php/topic,32355.0.html
Quote from: kleo on January 25, 2010, 07:42:48 PMI have more pages (and sections) with the module News. But I use not Groups by News module.How can I use Anynews to display newsitems from certain pages or section?How can I change the code?Earlier in this thread VotreEspace posted an excellent solution for section_ID support: https://forum.WebsiteBaker.org/index.php/topic,409.msg95799/topicseen.html#msg95799Thank YOU!I think this feature should be added as a built-in option to the module!
I have more pages (and sections) with the module News. But I use not Groups by News module.How can I use Anynews to display newsitems from certain pages or section?How can I change the code?
// replace the news article dependend template placeholders $tpl->set_var(array( 'WB_URL' => WB_URL,...more code going here...
$group_id = $row['group_id']; $image = ''; if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg')) { $image = '<img src="'.WB_URL.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg'.'" alt="" />'; }
'GROUP_IMAGE' => $image,
102 $the_description = str_replace('"', '', $the_description); 103 $the_description = str_replace(' ', '', $the_description);
$max_title_lenght = 20,
(strtoupper($lang_id) == 'AUTO')?$asked_language=LANGUAGE:$asked_language=strtoupper($lang_id);
loadLanguageFile($lang_id);
$join = NULL; $fields = '*'; $group = NULL; if ( $sort_by == 5 ) { $join = ' LEFT JOIN '.TABLE_PREFIX.'mod_news_comments AS t2 ON t1.post_id=t2.post_id '; $fields = 't1.*, count(comment_id) AS comment_count'; $group = 'GROUP BY t1.post_id'; }
$join = 'JOIN `'.TABLE_PREFIX.'pages` AS t3 ON t3.`page_id` = t1.`page_id`'; $fields = 't1.*, t3.`language`'; $group = "AND t3.`language` = '".$asked_language."'"; if ( $sort_by == 5 ) { $join = 'LEFT JOIN '.TABLE_PREFIX.'mod_news_comments AS t2 ON t1.post_id=t2.post_id JOIN `'.TABLE_PREFIX.'pages` AS t3 ON t3.`page_id` = t1.`page_id`'; $fields = 't1.*, t3.`language`, count(comment_id) AS comment_count'; $group = "AND t3.`language` = '".$asked_language.'\' GROUP BY t1.post_id'; }
...$join = NULL;$fields = '*';$group = NULL;if ( $sort_by == 5 ) { $join = ' LEFT JOIN '.TABLE_PREFIX.'mod_news_comments AS t2 ON t1.post_id=t2.post_id '; $fields = 't1.*, count(comment_id) AS comment_count'; $group = 'GROUP BY t1.post_id';}/** * Perform SQL database query for Anynews */$table = TABLE_PREFIX . 'mod_news_posts';...
...$join = NULL;$fields = '*';$group = NULL; $join = ' LEFT JOIN '.TABLE_PREFIX.'mod_news_comments AS t2 ON t1.post_id=t2.post_id ';$fields = 't1.*, count(comment_id) AS comment_count';$group = 'GROUP BY t1.post_id'; /** * Perform SQL database query for Anynews */$table = TABLE_PREFIX . 'mod_news_posts';...
$post_long = ($post['content_long']);
$post_long = ($post['content_long'] != '') ? $post['content_long'] : $post['content_short'];
I need to show the last news...ok...it´s easy, but if i need to show not the last news, but starting with the last before the last one...understand ?
ORDER BY $sql_order_by $sql_sort_order LIMIT 0, $max_news_items";
ORDER BY $sql_order_by $sql_sort_order LIMIT 1, $max_news_items";
if (!function_exists('displayNewsItems')) { function displayNewsItems( $group_id = 0, $max_news_items = 10, $max_news_length = -1, $display_mode = 1, $lang_id = 'AUTO', $strip_tags = true, $allowed_tags = '<p><a><img>', $custom_placeholder = false, $sort_by = 1, $sort_order = 1, $not_older_than = 0, $min_news_items = 0 ) {
$sql = "SELECT $fields FROM `$table` AS t1 $join WHERE `active` = '1' AND $sql_group_id AND (`published_when` = '0' OR `published_when` <= '$server_time') AND (`published_until` = '0' OR `published_until` >= '$server_time') AND $sql_not_older_than $group ORDER BY $sql_order_by $sql_sort_order LIMIT $min_news_items, $max_news_items";
if (function_exists('displayNewsItems')) { displayNewsItems( $group_id = 9 );}