vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   How to remove HTML tags from thread preview (good for HTML-enabled forums especially) (https://vborg.vbsupport.ru/showthread.php?t=61372)

Gary King 02-09-2004 10:00 PM

How to remove HTML tags from thread preview (good for HTML-enabled forums especially)
 
Don't you just hate it when thread previews show HTMl tags even though browsers don't interprete those tags in popup menus? Well then this hack is just right for you! ;)

This hack will remove all HTML tags such as <b>, <i>, <strong> and even closing tags like </b>, </i>, and </strong> so that they don't show up in the thread preview. It's genius they say! :p

Anyways here we go:

open up forumdisplay.php and find
PHP Code:

                eval('$threadbit .= "' fetch_template('threadbit') . '";'); 

Above, add

PHP Code:

                $thread[preview] = eregi_replace('(")','',strip_tags(unhtmlspecialchars($thread[preview]))); // solution #2 

If the above code doesn't show some thread previews properly, try the one below:
PHP Code:


                $thread
[preview] = eregi_replace('(&[a-z]+;|&lt;[a-zA-Z]+&gt;[a-zA-Z]+&lt;/[a-zA-Z]+&gt;)','',strip_tags($thread[preview])); 

All done :)

Andreas 02-10-2004 12:01 AM

Nice, but why not just

PHP Code:

$thread[preview] = strip_tags($thread[preview]); 

?

Gary King 02-10-2004 12:18 AM

Fixed :) (You needed unhtmlspecialchars()) first.

Andreas 02-10-2004 12:25 AM

Hmm ... now this code might produce invalid XHTML (thinking of quotes and ampersand).

Gary King 02-10-2004 12:27 AM

*testing* :) I'll post back with a full solution when I have one, should take a few minutes only heh :D

Andreas 02-10-2004 12:40 AM

PHP Code:

 $thread[preview] = htmlspecialchars(strip_tags(unhtmlspecialchars($thread[preview]))); 

might do the trick ;)

Gary King 02-10-2004 12:46 AM

Foolproof solution attached ;)

CarlitoBrigante 02-10-2004 09:01 AM

Quote:

Originally Posted by Gary W
Foolproof solution attached ;)

Great it work! Should be enabled by default in next vb builds, can't someone contact the development staff?

Gary King 02-10-2004 11:20 AM

You could submit it as a bug and link to this thread if you want :p

CarlitoBrigante 02-10-2004 12:48 PM

Quote:

Originally Posted by Gary W
You could submit it as a bug and link to this thread if you want :p

Will do!


All times are GMT. The time now is 02:36 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01160 seconds
  • Memory Usage 1,737KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete