1

In Joomla 4.3.1, I've made an override of the com_content/archive/default_items.php Now I want to strip tags and display the string (text from article) as one line <p> only. Without any formatting. No <strong>, <em>, <br>, <h3> etc.

This is the code where I somewhere want to add the string function "strip_tags":

<?php if ($params->get('show_intro')) : ?>
    <div class="intro" itemprop="articleBody">
        <?php echo HTMLHelper::_('string.truncateComplex', $item->introtext, $params->get('introtext_limit')); ?>
    </div>
<?php endif; ?>

It goes without saying I'm a PHP-beginner, and I've researched the PHP- and Joomla-forums. Googling the "truncateComplex" does not really give anything. And all my attemps just break my site.

1 Answer 1

0
  1. One way:

    $stripIntro = strip_tags( value, $item->introtext ); 
    

    then

    HTMLHelper::_('string.truncateComplex',$stripIntro, $params->get('introtext_limit'); ?>
    
  2. Or another way:

    $stripIntro = HTMLHelper::_('string.truncateComplex',$item->introtext, $params->get('introtext_limit'); ?>
    

    then strip tags

    echo strip_tags(value, $stripIntro);
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.