开发者

Strip H1 tag and its contents

How can i remove

<h1>and its contents</h1>

from the following line

strip_tags(substr($article->content(),0,255)

from this complete code

<?php $last_articles = $this->children(array('limit'=>5, 'order'=>'page.created_on DESC')); ?>
<?php foreach ($last_articles as $article): ?>
<div class="entry">
  <h3><?php echo $article->link($article->titl开发者_C百科e); ?></h3>
  <?php echo strip_tags(substr($article->content(),0,255).'...', '<p><a>'); ?>
</div>
<?php endforeach; ?>


Try this:

$my_title = preg_replace('/<h1[^>]*>([\s\S]*?)<\/h1[^>]*>/', '', $article->content());

Related Resource:

http://sarfraznawaz.wordpress.com/2009/09/08/dreamweaver-tip-search-replace-code-snippets/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜