Для админки:
Открыть /engine/inc/addnews.php
добавить:
function resizetext($text,$max){
$words = explode(" ",$text);
$wordcount = count($words);
if ($wordcount>$max) $wordcount = $max;
for ($i=0;$i<$wordcount;$i++){
$str.=$words[$i]." ";
}
return $str;
}
$short_story=resizetext($full_story,"25")."...";
перед:
$db->query( "INSERT INTO " . PREFIX . "_post (date, autor, short_story, full_story, xfields, title, descr, keywords, category, alt_name, allow_comm, approve, allow_main, fixed, allow_rate, allow_br, votes, access, symbol, flag, tags, metatitle) values ('$thistime', '{$member_id['name']}', '$short_story', '$full_story', '$filecontents', '$title', '{$metatags['description']}', '{$metatags['keywords']}', '$category_list', '$alt_name', '$allow_comm', '$approve', '$allow_main', '$news_fixed', '$allow_rating', '$allow_br', '$add_vote', '$group_regel', '$catalog_url', '1', '{$_POST['tags']}', '{$metatags['title']}')" );
Для сайта:
открыть /engine/modules/addnews.php
найти:
$db->query( "INSERT INTO " . PREFIX . "_post (date, autor, short_story, full_story, xfields, title, keywords, category, alt_name, allow_comm, approve, allow_main, fixed, allow_rate, allow_br, flag, tags) values ('$thistime', '$member_id[name]', '$short_story', '$full_story', '$filecontents', '$title', '', '$category_list', '$alt_name', '$allow_comm', '$approve', '$allow_main', '$news_fixed', '$allow_rating', '$allow_br', '1', '" . $_POST['tags'] . "')" );
Добавить перед:
function resizetext($text,$max){
$words = explode(" ",$text);
$wordcount = count($words);
if ($wordcount>$max) $wordcount = $max;
for ($i=0;$i<$wordcount;$i++){
$str.=$words[$i]." ";
}
return $str;
}
$short_story=resizetext($full_story,"25")."...";
Для существующих новостей(заменяет первые два):
Открыть /engine/modules/showshort.php
Найти:
$tpl->set( '{short-story}', stripslashes( "<div id='news-id-" . $row['id'] . "'>" . $row['short_story'] . "</div>" ) );
Заменить на:
function resizetext($text,$max){
$words = explode(" ",$text);
$wordcount = count($words);
if ($wordcount>$max) $wordcount = $max;
for ($i=0;$i<$wordcount;$i++){
$str.=$words[$i]." ";
}
return $str;
}
$tpl->set( '{short-story}', resizetext(stripslashes( "<div id='news-id-" . $row['id'] . "'>" . $row['short_story'] . "</div>" ) ,"25"));