Что нового

Тег {full-story} в шаблоне короткой новости (1 Viewer)

Mr.S

Mr.S

Гуру
Owner
SkripTers TEAM
SEOшники
Регистрация
25 Дек 2019
Сообщения
89
Реакции
72
Здравствуйте человеки!
Помогите сделать работоспособными теги {full-story} и {full-story limit="X"} в шаблоне краткой новости (shortstory.tpl)
В основном на DLE 14.x
Но если будет вариант под версии поновее, думаю это проблем не должно вызвать.
 
Здравствуйте человеки!
Помогите сделать работоспособными теги {full-story} и {full-story limit="X"} в шаблоне краткой новости (shortstory.tpl)
В основном на DLE 14.x
Но если будет вариант под версии поновее, думаю это проблем не должно вызвать.
Открыть /engine/engine.php найти в SQL запросе (примерно 14 шт.)

Код:
CHAR_LENGTH(p.full_story) as full_story

Заменить на (привести в такой вид)

Код:
p.full_story

Открыть /engine/modules/show.short.php найти

Код:
if ( preg_match( "#\\{short-story limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches ) ) {

выше вставить :

Код:
$row['full_story'] = stripslashes($row['full_story']);
$tpl->set( '{full-story}', $row['full_story'] );

if ( preg_match( "#\\{full-story limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches ) ) {
    $count= intval($matches[1]);
   
    $row['full_story'] = preg_replace( "#<!--TBegin(.+?)<!--TEnd-->#is", "", $row['full_story'] );
    $row['full_story'] = preg_replace( "#<!--MBegin(.+?)<!--MEnd-->#is", "", $row['full_story'] );
    $row['full_story'] = preg_replace( "'\[attachment=(.*?)\]'si", "", $row['full_story'] );
    $row['full_story'] = preg_replace ( "#\[hide\](.+?)\[/hide\]#ims", "", $row['full_story'] );
       
    $row['full_story'] = str_replace( "</p><p>", " ", $row['full_story'] );
    $row['full_story'] = strip_tags( $row['full_story'], "<br>" );
    $row['full_story'] = trim(str_replace( "<br>", " ", str_replace( "<br />", " ", str_replace( "\n", " ", str_replace( "\r", "", $row['full_story'] ) ) ) ));

    if( $count AND dle_strlen( $row['full_story'], $config['charset'] ) > $count ) {
           
        $row['full_story'] = dle_substr( $row['full_story'], 0, $count, $config['charset'] );
           
        if( ($temp_dmax = dle_strrpos( $row['full_story'], ' ', $config['charset'] )) ) $row['full_story'] = dle_substr( $row['full_story'], 0, $temp_dmax, $config['charset'] );
       
    }

    $tpl->set( $matches[0], $row['full_story'] );

}

теги :
Код:
{full-story}
{full-story limit="200"}

Автор: PunPun aka LazyDev
 
  • Like
Реакции: Mr.S

Пользователи, просматривающие данную тему

Верх