Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Parse/Strip HTML Tags

 
Reply to topic    Forum Index » Suggestions View previous topic
View next topic
Parse/Strip HTML Tags
Author Message
rats



Joined: 29 May 2006
Posts: 44

Post Parse/Strip HTML Tags Reply with quote
It would be nice if someone can make a parsing script that removes the html tags within the template, like [parse]...[/parse] Smile
Fri Sep 07, 2007 5:33 pm View user's profile Send private message
Guest








Please login to hide the ads.

rats



Joined: 29 May 2006
Posts: 44

Post Reply with quote
sorry for the double post, but I'm not the kind of man who ask for something and hopes to have it by tomorrow at afternoon, and I did something really neat, but not the way I wanted.

I've managed to make a strip tag but you won't be able to use it on other tags (like [parse]{sShortStory|300}[/parse] which was my main goal) but you can still use it in a very n00bish way until someone puts it in a plugin and make a truncate function with it. So:

Open show.news.php in cutenews/inc/

Find
Code:
       $output = str_replace('{id}', $row['id'], $output);


Add above
Code:
      $strip = run_filters('news-entry-content', $row['short']);
      $strip = ereg_replace("<[^>]*>","",$strip);
      $strip = ereg_replace("\[[^>]*\]","",$strip);
      // $strip = substr($strip, 0, 90);


Find
Code:
      $output = str_replace('{alternating}', $alternating, $output);


Add below
Code:
      $output = str_replace('{strip}', $strip, $output);


Use the {strip} tag in your template to echo the short-story (!!!) with no html AND QUICKTAGS.

Some explaining:
I've "stoled" the replacement function from the BadDog's MySQL Search... that's the
Code:
$strip = ereg_replace("<[^>]*>","",$strip);

Next I've redone it to strip the QuickTags here:
Code:
      $strip = ereg_replace("\[[^>]*\]","",$strip);


IF YOU WANT TO TRUNCATE THE CODE LIKE sShortStory PLUGIN FROM FI-DD (but much gayer)
Change
Code:
      // $strip = substr($strip, 0, 90);

to
Code:
      $strip = substr($strip, 0, 90);


and change "90" to your desired number of characters.

I hope someone will pick what I've done here and port it lie Fi-dd's sShortStory plogin so we'll be able to use {strip|90} or something Very Happy

Cheers
Fri Sep 07, 2007 6:32 pm View user's profile Send private message
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2736
Location: Germany

Post Reply with quote
Just add the stripping part to the plugin...

Open plugins/shortShortStory.php and find this:
Code:
preg_match('/{sShortStory\|(\d+)}/i', $output, $temp);


add below:
Code:
$row['short'] = ereg_replace("<[^>]*>","",$row['short']);
$row['short'] = ereg_replace("\[[^>]*\]","",$row['short']);

Mon Sep 10, 2007 5:49 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    Forum Index » Suggestions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Music Lyrics.