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
P.S.: Webbird nice to see that you will maintain the snippet in the future
// leave original line, but comment out// $row['content_short'] = substr($row['content_short'], $start_pos, $max_news_length) . '...';// after, add: $row['content_short'] = wordwrap2( substr( $row['content_short'], $start_pos ), $max_news_length ) . '...';
function wordwrap2( $str, $width = 75, $break = '\n', $cut = true ) { $str = html_entity_decode( $str ); //first decode $out = wordwrap( $str, $width, $break, $cut ); //now wordwrap $out = htmlentities( $out ); //re-encode the entities $out = str_replace( htmlentities( $break ), $break, $out ); //put back the break // return the first line $temp = explode( $break, $out ); return $temp[0];}
DisplayNewsItems( 0, 10, 50 );
$table = TABLE_PREFIX . 'mod_news_posts'; $sql = "SELECT * FROM `$table` WHERE `active` = '1'This line ---------> 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 ORDER BY $sql_order_by $sql_sort_order LIMIT 0, $max_news_items";
function displayNewsItems( $section_id = 0, $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)
sanitizeUserInputs($section_id, 'i{0;0;999}');
sanitizeUserInputs($group_id, 'i{0;0;999}');
// check for multiple sections or single section values if (is_array($section_id)) { // SQL query for multiple groups $sql_section_id = ' AND `section_id` IN (' . implode(',', $section_id) . ')'; } else { // SQL query for single or empty groups $sql_section_id = ($section_id) ? 'AND `section_id` = \'' . $section_id . '\'' : '1'; }
// show all groups if group_id is array which contains 0 if (is_array($group_id) && in_array(0, $group_id)) $group_id = 0; // check for multiple groups or single group values if (is_array($group_id)) { // SQL query for multiple groups $sql_group_id = '`group_id` IN (' . implode(',', $group_id) . ')'; } else { // SQL query for single or empty groups $sql_group_id = ($group_id) ? '`group_id` = \'' . $group_id . '\'' : '1'; }
$sql = "SELECT * FROM `$table` WHERE `active` = '1' AND $sql_group_id $sql_section_id AND (`published_when` = '0' OR `published_when` <= '$server_time') AND (`published_until` = '0' OR `published_until` >= '$server_time') AND $sql_not_older_than ORDER BY $sql_order_by $sql_sort_order LIMIT 0, $max_news_items";
<?phpif (function_exists('displayNewsItems')) { if (LANGUAGE == 'NL') { displayNewsItems(2,3,-1,1,'nl',true, '<p><a><img>','none',4, 3,'disabled'); } else { displayNewsItems(3,3,-1,1,'en',true, '<p><a><img>','none',4, 3,'disabled'); }} ?>
you have to create a group for each language and then specificly call the group in the anynews call.he language-file is for the readmore link and the date.
Do you have the "language" in the URL exactly like in the anynews parameter and is it shown as well in the URL if you open the news page?
<?php if(function_exists('display_news_items')) { display_news_items(0, 5, 50, 1, "", "mehr lesen", "aktuell gibt es keine news...", false); } else { echo 'Requires code snippet anynews (WB addons repository) to display news here.'; } ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title><?php page_title(); ?></title><meta http-equiv="Content-Type" content="text/html; charset=<?php if(defined('DEFAULT_CHARSET')) { echo DEFAULT_CHARSET; } else { echo 'utf-8'; }?>" /><meta name="description" content="<?php page_description(); ?>" /><meta name="keywords" content="<?php page_keywords(); ?>" /><link rel="stylesheet" type="text/css" media="screen,projection,print" href="<?php echo TEMPLATE_DIR; ?>/layout4_setup.css" /><link rel="stylesheet" type="text/css" media="screen,projection,print" href="<?php echo TEMPLATE_DIR; ?>/layout4_text.css" /><title>Multiflex-3 Update-2 / Overview</title></head><!-- Global IE fix to avoid layout crash when single word size wider than column width --><!--[if IE]><style type="text/css"> body {word-wrap: break-word;}</style><![endif]--><body><body><!-- Main Page Container --><div class="page-container"><!-- For alternative headers START PASTE here --><!-- A. HEADER --><div class="header"> <div class="nav2"> <!-- Navigation item --><?php if(SHOW_MENU) { /* Only shown menu if we need to */ ?> <?php show_menu2(0, SM2_ROOT, SM2_START, SM2_PRETTY, '<li [if(class==menu-current){id="menu-current"}]>[a]<span>[menu_title]</span></a>'); ?> <?php } ?> </div><!-- A.2 HEADER MIDDLE --> <div class="header-middle"> [[RandomImage?dir=header]] <!-- Site message --> <div class="sitemessage"> </div> </div> <!-- A.3 HEADER BOTTOM --> <div class="header-bottom"> </div> <div class="header-breadcrumbs"> </div> <!-- B. MAIN --> <div class="main"> <!-- B.1 MAIN NAVIGATION --> <div class="main-navigation"> <!-- Navigation Level 3 --> <div class="round-border-topright"></div> <h1 class="first">Menü</h1> <!-- Navigation with grid style --> <?php show_menu2(0, SM2_ROOT+1, SM2_CURR+1, SM2_PRETTY, '<dt>[a][menu_title]</a>', '</dt>', '<dl class="nav3-grid">' , '</dl>');?> </div> <!-- B.2 MAIN CONTENT --> <div class="main-content"> <!-- Pagetitle --> <h1 class="pagetitle"><?php echo PAGE_TITLE; ?></h1> <!-- Content unit - One column --> <div class="column1-unit"> <?php page_content(); ?> </div> </div> <!-- B.3 SUBCONTENT --> <div class="main-subcontent"> <!-- Subcontent unit --> <div class="subcontent-unit-border-orange"> <div class="round-border-topleft"></div> <div class="round-border-topright"></div> <h1 class="orange">latest news</h1> <?php if(function_exists('displayNewsItems')) { display_news_items(0, 5, 50, 1, "", "mehr lesen", "aktuell gibt es keine news...", false); } else { echo 'Requires code snippet anynews (WB addons repository) to display news here.'; } ?> </div> </div> </div> <!-- C. FOOTER AREA --> <div class="footer"> <p><?php page_footer(); ?></p> </div></div></body></html>