开发者

how can strips html tags in joomla

开发者 https://www.devze.com 2022-12-18 18:00 出处:网络
hi i am working on joomla. and i used the latest news module but it emerging a problem that the new display on page having the tags like paragraphi wanna remove that tags from the news

hi i am working on joomla. and i used the latest news module but it emerging a problem that the new display on page having the tags like paragraph

i wanna remove that tags from the news

my code is

      <?php // no direct access
     defined('_JEXEC') 开发者_如何学编程or die('Restricted access'); ?>

     <?php $i=1 ;?>
      <?php foreach ($list as $item):  ?>
     <?php if($i==1) {echo "<div class='latestnews_ttl'>       <p>".$item->cat_title."               </p></div>";} $i++; ?>
 <div class="news_box">
<p style=" padding:0px;"><strong><?php echo $item->text; ?> </strong></p>


<p><?php if(strlen($item->introtext)>100) 
                {
                    $txt =  str_split($item->introtext, 100);
                    echo $txt['0']."...";
            }
            else{
                    echo $item->introtext; 
            }
            ?></p>



            <div class='readmore'><a href="<?php echo $item->link;?>">read more</a></div></div>
<?php endforeach; ?>

It will give news with prefix tag "<p>" so please give the solution of it.

thanks in advance


Tried strip_tags() ?


Always remember in Joomla! never to modify core code, always overwrite the core templates by following the following guide http://docs.joomla.org/Tutorial_talk:Template_overrides

1: http://docs.joomla.org/Tutorial_talk:Template_overrides or a quick how to http://www.techportal.co.za/joomla/joomla-tutorials/124-how-to-modify-the-appearance-of-the-category-list-page-without-having-modifications-done-to-the-joomla-core-code

If you do this in the core it will work, but once you may upgrade your changes could be gone.


Since joomla is written in php you could use strip_tags

0

精彩评论

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