We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

HTML Stripper plugin not working

Development and Programming

awa's avatar
awa
77 posts
16 years ago
awa's avatar awa

Hi support, I installed the HTML Stripper plugin, version 1.0.1, author Paul Burdick from the ee 2.0 Beta-ZIP-package. When I use it in this code

{exp:channel:entries channel="blog" limit="5" orderby="date" sort="desc"}
        <li><a href="http://{path=%22blog/artikel%22}" title="{exp:html_strip}{intro}{/exp:html_strip}">{title}</a></li>
        {/exp:channel:entries}

i get a blank page. The code above works fine without the html_strip. Nothing besides <body><html></html></body> gets rendered.

Even a

{exp:html_strip}This is text<b>{/exp:html_strip}

leads to the same blank page. I would assume, that the output should be

This is text

So it has nothing to to with the channel entries tag.

If you need more info, just say so.

Thanks awa

Moved to Plugins by Moderator

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

awa, that plugin hasn’t been converted to 2.0 yet.

http://expressionengine.com/downloads/details/html_strip/

       
awa's avatar
awa
77 posts
16 years ago
awa's avatar awa

Hi Sue, ah, ok. Thanks for the quick reply. But why is it then part of the “EllisLab ExpressionEngine 2.0 Public Beta add-ons”? I downloaded the ZIP and all the plugins within installed themselves properly (own folder under third_party-directory), so when I use the CP to access the plugin I see it and it looks, as if it´s ready to go. And the char_limit plugin which is also part of the package works fine.

So, what you are saying is, that not all plugins in the Beta add-ons are actually ported to 2.0? If yes, when do you think, the plugin will be 2.x?

Cheers awa

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

When I downloaded the add-ons, that file wasn’t included. I’ll try downloading again, and see if I get it this time around.

       
JonnyT's avatar
JonnyT
36 posts
16 years ago
JonnyT's avatar JonnyT

Did this eventually work? Or is there an alternative to HTML Strip?

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

JonnyTurner and awa - this plugin isn’t in the downloadable zip file of converted plugins. I’m not aware of any existing plugins, but you might put in a Feature Request for it to be converted.

       
Dave Seah's avatar
Dave Seah
10 posts
16 years ago
Dave Seah's avatar Dave Seah

I just started my Expression Engine 1.x to 2.x transition, and hit the same problem. I was able to modify the old one to work with the new one…it’s a really short plugin.

Here’s the first 40 lines of old code of pi.html_strip.php:

<?php

/*
=====================================================
 ExpressionEngine - by pMachine
-----------------------------------------------------
 http://www.pmachine.com/
-----------------------------------------------------
 Copyright (c) 2003 pMachine, Inc.
=====================================================
 THIS IS COPYRIGHTED SOFTWARE
 PLEASE READ THE LICENSE AGREEMENT
 http://www.pmachine.com/license/
=====================================================
 File: pi.html_strip.php
-----------------------------------------------------
 Purpose: HTML stripper plugin
=====================================================

*/


$plugin_info = array(
                        'pi_name'            => 'HTML Stripper',
                        'pi_version'        => '1.0.1',
                        'pi_author'            => 'Paul Burdick',
                        'pi_author_url'        => 'http://www.pmachine.com/',
                        'pi_description'    => 'Removes HTML code from text',
                        'pi_usage'            => HTML_strip::usage()
                    );


class HTML_strip {

    var $return_data;

    
    // ----------------------------------------
    //  Character Limiter
    // ----------------------------------------

    function HTML_strip($str = '')
    {
        global $TMPL, $FNS;
                        
        $convert        = ( ! $TMPL->fetch_param('convert'))        ? 'n'        :  $TMPL->fetch_param('convert');
        $convert_back    = ( ! $TMPL->fetch_param('convert_back'))    ? 'original':  $TMPL->fetch_param('convert_back');
        $keep            = ( ! $TMPL->fetch_param('keep'))            ? ''        :  $TMPL->fetch_param('keep');
        $template        = ($str == '') ? $TMPL->tagdata : $str;
        
        $template        = str_replace('/', '/',$template);

. . . And below are the modified lines. It just converts from the old parameter setup style to the new style: . . .

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$plugin_info = array(
                        'pi_name'            => 'HTML Stripper UNOFFICIAL EE 2.X CONVERSION',
                        'pi_version'        => '1.0.1',
                        'pi_author'            => 'Paul Burdick',
                        'pi_author_url'        => 'http://expressionengine.com/',
                        'pi_description'    => 'Removes HTML code from text',
                        'pi_usage'            => HTML_strip::usage()
                    );

/**
 * HTML_strip Class
 *
 * @package            ExpressionEngine
 * @category        Plugin
 * @author            UNOFFICIAL EE2.X CONVERSION 
 * @copyright        Copyright (c) 2004 - 2009, EllisLab, Inc.
 * @link                http://expressionengine.com/downloads/details/html_strip/
 */
 
class HTML_strip {

    var $return_data;

    
    // ----------------------------------------
    //  HTML Stripper
    // ----------------------------------------

    function HTML_strip($str = '')
    {

        $this->EE =& get_instance();
        $convert        = ( ! $this->EE->TMPL->fetch_param('convert'))        ? 'n'        :  $this->EE->TMPL->fetch_param('convert');
        $convert_back    = ( ! $this->EE->TMPL->fetch_param('convert_back'))    ? 'original':  $this->EE->TMPL->fetch_param('convert_back');
        $keep            = ( ! $this->EE->TMPL->fetch_param('keep'))            ? ''        :  $this->EE->TMPL->fetch_param('keep');
        $template        = ($str == '') ? $this->EE->TMPL->tagdata : $str;
        
        $template        = str_replace('/', '/',$template);

. . . It APPEARS to work on my test installation. I hope this is OK to post here. I’ve changed the plugin info with the string “UNOFFICIAL EE 2.x CONVERSION” to remind myself that it’s something I should check later.

To complete the conversion, I created a folder called html_strip in my system/expressionengine/thirdparty/ folder and dropped the file in it.

I don’t know why I couldn’t use the two other “plugins” folders in system and system/expressionengine. Could some one tell me what the difference is?

       
Greg Salt's avatar
Greg Salt
3,988 posts
16 years ago
Greg Salt's avatar Greg Salt

Hi awa,

Does David’s solution in thread help you out?

Cheers

Greg

       
Greg Salt's avatar
Greg Salt
3,988 posts
16 years ago
Greg Salt's avatar Greg Salt

Hi David,

The third_party folder is the correct place to put new plugins for EE2.x. The other plugins folders are for Codeigniter and EE core plugin components respectively.

Cheers

Greg

       
awa's avatar
awa
77 posts
16 years ago
awa's avatar awa

Hi Greg,

Does David’s solution in thread help you out?

First: Thanks to David! I got it working, but I have trouble with the keep-Parameter. If I say keep=”p”, it keeps the p-tag, so after stripping i have a

, but with the

the < and the > are & lt;/a & gt; (I broke the entities to make it show up here) And this is not working. I tried a lot of combinations of convert and convert_back, but the closing tags like

</a>, </b>...

are not working.

Cheers awa

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

awa, since you’re working with slightly modified code, I’m going to move this to the Plugins forum.

       
Marc Debiak's avatar
Marc Debiak
36 posts
about 16 years ago
Marc Debiak's avatar Marc Debiak

Hello!

I am having a similar problem with HTML_STRIP

For example my code is:

{exp:char_limit total="45"}{exp:html_strip}{news_body}{/exp:html_strip}{/exp:char_limit}

Yet this outputs an excerpt of 45 characters with the html still included…

Maybe this plugin can’t be used within the char_limit?

I’m currently using the plugin with EE v1.6.8

Thanks!

       
smartpill's avatar
smartpill
456 posts
about 16 years ago
smartpill's avatar smartpill
Hello! I am having a similar problem with HTML_STRIP For example my code is:
{exp:char_limit total="45"}{exp:html_strip}{news_body}{/exp:html_strip}{/exp:char_limit}
Yet this outputs an excerpt of 45 characters with the html still included… Maybe this plugin can’t be used within the char_limit? I’m currently using the plugin with EE v1.6.8 Thanks!

You might want to try adding parse=”inward”:

{exp:char_limit total="45" parse="inward"}

that way the limit will be processed first then strip out the HTML.

       
Marc Debiak's avatar
Marc Debiak
36 posts
about 16 years ago
Marc Debiak's avatar Marc Debiak
You might want to try adding parse=”inward”:
{exp:char_limit total="45" parse="inward"}
that way the limit will be processed first then strip out the HTML.

That worked! Thanks!

       
Jonathan Schofield's avatar
Jonathan Schofield
175 posts
15 years ago
Jonathan Schofield's avatar Jonathan Schofield

Many thanks, Dave.

This seems to work a treat.

Hope Paul Burdick is able to officially test/sanction it.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.