コード例 #1
0
ファイル: articleList.php プロジェクト: WinGood/24karcher
                <img src="<?php 
        echo SITE . '/mg-admin/design/images/no-img.png';
        ?>
" alt=""/>
            <?php 
    }
    ?>
        </div>
        <div class="content">
            <a href="<?php 
    echo SITE;
    echo $news['path'];
    ?>
"
               class="title-news"><?php 
    echo $news['title'];
    ?>
</a>
            <?php 
    echo mb_substr(strip_tags(PM::stripShortcodes($news['description'])), 0, 300, 'utf-8') . "...";
    ?>
            <a href="<?php 
    echo SITE;
    echo $news['path'];
    ?>
" class="link-news">Подробней &#8594;</a>
        </div>
    </div>
<?php 
}
echo $data['pagination'];
コード例 #2
0
ファイル: index.php プロジェクト: WinGood/24karcher
 /**
  * Печатает на экран анонс заданной новости
  * @param type $news - массив с данными о новости (полностью запись из БД)
  */
 public static function anonsNews($args)
 {
     $args['count'] = $args['count'] ? $args['count'] : 4;
     $data = self::getListNews($args['count']);
     $listNews = $data['listNews'];
     $html = "";
     if (!empty($listNews)) {
         $nIteration = 0;
         foreach ($listNews as $news) {
             if ($nIteration == 0) {
                 $html .= '<div class="tab tab-first">';
             } else {
                 if ($nIteration % 2 == 0) {
                     $html .= '<div class="tab">';
                 }
             }
             $html .= '
       <div class="news-main-page clearfix">
         <div class="news-img"><img src=' . SITE . '/uploads/news/' . $news['image_url'] . ' alt=' . $news['title'] . ' /></div>
         <div class="desc">
           <p class="title"><a href="news/' . $news['url'] . '">' . ucfirst($news['title']) . '</a></p>
           <p class="date"><i class="icon-time"></i> ' . strftime('%e %B, %Y', strtotime($news['add_date'])) . '</p>
           <p class="text-desc">' . ucfirst(mb_substr(strip_tags(PM::stripShortcodes($news['description'])), 0, 140, 'utf-8')) . '...</p>
         </div><!-- !div.desc -->
       </div><!-- !div.news-main-page -->';
             $nIteration++;
             if ($nIteration % 2 == 0) {
                 $html .= '</div><!-- !div.tab -->';
             }
         }
     } else {
         $html .= '<div class="white-box bor-b">Новости не найдены</div><!-- !div.page-content-box -->';
     }
     return $html;
 }
コード例 #3
0
ファイル: mg.php プロジェクト: nellka/mebel
 /**
  * Отрезает часть строки дополняя ее многоточием, вырезает шорткоды.
  * @param string $text входящая строка
  * @param int $length количество символов
  * @return string
  */
 public static function textMore($text, $length = 240)
 {
     $text = strip_tags(PM::stripShortcodes($text));
     $more = "...";
     if (strlen($text) <= $length) {
         $more = '';
     }
     return mb_substr($text, 0, $length, 'utf-8') . $more;
 }