vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   html -> bbcode function (https://vborg.vbsupport.ru/showthread.php?t=74759)

sabret00the 01-20-2005 09:01 PM

html -> bbcode function
 
PHP Code:

        $message "Reporting Post: [url=viewthread.php?$session[sessionurl]g=$g&#post$p]Post ID #$p[/url]\n\nReason: htmlspecialchars($reason)"

this line is spitting out an error, so i'm thinking
PHP Code:

        $message "Reporting Post: <a href=\"viewthread.php?$session[sessionurl]g=$g&amp;#post$p\">Post ID #$p</a>\n\nReason: htmlspecialchars($reason)"

but in order to do that i need to convert the html to bbcode, and i'm sure i've seen a function for it but can't find it, does anyone know what it is?

Marco van Herwaarden 01-20-2005 09:11 PM

What error you're getting?

sabret00the 01-20-2005 09:42 PM

Code:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
parse error, i'm thinking it's because of the square brackets.

WetWired 01-21-2005 01:06 AM

Quote:

Originally Posted by sabret00the
Code:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
parse error, i'm thinking it's because of the square brackets.

Just use single quotes and the concatenation operator:
PHP Code:

$message 'Reporting Post: [url=viewthread.php?'.$session[sessionurl].'g='.$g.'&amp;#post'.$p.']Post ID #'.$p.'[/url]\n\nReason: '.htmlspecialchars($reason); 


Andreas 01-21-2005 01:32 AM

Escape-Code in single quotes don't work.

Try this
PHP Code:

$message "Reporting Post: [url=viewthread.php?$session[sessionurl]g=$g&amp;#post$p]Post ID #$p"[/url]\n\nReason: " htmlspecialchars($reason); 

The function to convert HTML to BB Code (as far as possible) is convert_wysiwyg_html_to_bbcode() in functions_wysiwyg.php

sabret00the 01-21-2005 08:21 AM

thanks kirby, now it don't actually need the html -> bbcode :)

thanks too wetwird :)


All times are GMT. The time now is 11:24 AM.

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.02511 seconds
  • Memory Usage 1,726KB
  • 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
  • (2)bbcode_code_printable
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete