<?php $result = getRecentComments($con); while ($recent = mysqli_fetch_assoc($result)) { ?> <div class="single_comments" style="height:64px"> <img src="assets/images/blog/avatar3.png" alt="" /> <p><?php echo wordlimit($recent['comments'], 80); ?> </p> <div class="entry-meta small muted"> <span>By <a href="#"><?php echo $recent['nama']; ?> </a></span <span>On <a href="#"><?php echo wordlimit($recent['judul'], 25); ?> </a></span> </div> </div> <?php } ?> </div> </div> </div><!--/.recent comments--> <div class="widget categories"> <h3>Categories</h3> <div class="row">
function wordlimit($string, $length = 40, $ellipsis = "...") { $string = strip_tags($string, '<div>'); $string = strip_tags($string, '<p>'); $words = explode(' ', $string); if (count($words) > $length) { return implode(' ', array_slice($words, 0, $length)) . $ellipsis; } else { return $string . $ellipsis; } } foreach ($recenltyUpdated as $p) { echo "<li>"; echo '<div class="news-item-date"><span class="news-item-day">' . date("jS", strtotime($p["pageUpdated"])) . '</span> <span class="news-item-month">' . date("M", strtotime($p["pageUpdated"])) . '</span> </div>'; echo '<div class="news-item-detail"> <a href="/admin/pages/edit/' . $p['pageID'] . '" class="news-item-title" target="_blank">' . $p['pageTitle'] . '</a>'; echo '<p class="news-item-preview">' . wordlimit($p['pageContentHTML']) . '</p>'; echo '</div>'; echo '</li>'; } ?> </ul> </div> <!-- /widget-content --> </div> <!-- /widget --> </div> <!-- /span6 --> </div> <!-- /row -->
<?php } ?> <div id="block-<?php print $block->module . '-' . $block->delta; ?> " class="block block-<?php print $block->module; ?> "> <?php if ($block->subject) { ?> <?php $firstword = wordlimit($block->subject, 1, ""); $block->subject = str_replace($firstword, "<span class=\"first-word\">" . $firstword . "</span>", $block->subject); ?> <h2 class="title block-title"><?php print $block->subject; ?> </h2> <?php } ?> <div class="content"> <?php print $block->content; ?> </div> </div>
function getPost($text) { $text = strip_tags($text); echo wordlimit($text, 300); }