DLE движок для сайтов
Вывод {full-story limit="100"} в краткой новости на DLE 10.2
Здравствуйте. Я знаю что данная тема обсуждалась не однократно но мне ничего не помогло на DLE 10.2. Мне заполнение краткой новости не нужно вообще при добавлении новости. Заполняется полная новость. И мне пришлось реализовать вывод {full-story} в краткой новости для DLE 10.2. Полный текст выводить в краткой новости но при добавлении {full-story limit="100"} ничего не выводит, только пусто и все. После

$tpl->set( '{short-story}', $row['short_story'] );                          if ( preg_match( "#{short-story limit=['"](.+?)['"]}#i", $tpl->copy_template, $matches ) ) {                 $count= intval($matches[1]);                      $row['short_story'] = str_replace( "

", " ", $row['short_story'] );                 $row['short_story'] = strip_tags( $row['short_story'], " " );                 $row['short_story'] = trim(str_replace( " ", " ", str_replace( " ", " ", str_replace( "n", " ", str_replace( "r", "", $row['short_story'] ) ) ) ));                      if( $count AND dle_strlen( $row['short_story'], $config['charset'] ) > $count ) {                                              $row['short_story'] = dle_substr( $row['short_story'], 0, $count, $config['charset'] );                                              if( ($temp_dmax = dle_strrpos( $row['short_story'], ' ', $config['charset'] )) ) $row['short_story'] = dle_substr( $row['short_story'], 0, $temp_dmax, $config['charset'] );                                      }                      $tpl->set( $matches[0], $row['short_story'] );                  }

Добавил

                         if ( preg_match( "#{full-story limit=['"](.+?)['"]}#i", $tpl->copy_template, $matches ) ) {                 $count= intval($matches[1]);                      $row['full_story'] = str_replace( "

", " ", $row['full_story'] );                 $row['full_story'] = strip_tags( $row['full_story'], " " );                 $row['full_story'] = trim(str_replace( " ", " ", str_replace( " ", " ", 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'] );                  }

Где здесь проблема? Почему не работает?

Источник: Amilo130

Перейти на сайт

Другие материалы на сайте b.Z - Записки о гаджетах, людях и музыке