miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
Master Class miniBB Support Forums / Master Class /   

Pure HTML in posts?..

Author Anonymous
Guest
#1 | Posted: 9 Mar 2005 13:47 
Hello

I installed your board and must say I'm impressed! But there is one problem. When I use simple html it isn't converted to BBcode automaticly. My users do those quizzilla things and they just post their results but those come out as pure HTML. Now, I've seen the function deCodeBB(string) so can't I use that to automate the HTML to BB? And where should I put it? I know some php, but this is a bit too much for me...

Author Team
8-)
#2 | Posted: 9 Mar 2005 13:54 
We are using only BB codes for processing HTML results.

However, you can edit bb_codes.php functions and create some new replacements which will automate direct HTML processing.

Example:

$pattern[]="/<b>(.+?)<\/b>/s";
$replacement[]='<b>\\1</b>';

will enable <b></b> code.

Author Anonymous
Guest
#3 | Posted: 9 Mar 2005 14:59 
I put that code in the deCodeBB() function but it still doesn't work when I use <b>blah</b>

Could it be that the text isn't processed? Could it be that it has something to do with the smilie2 plugin I installed?

Author Team
8-)
#4 | Posted: 9 Mar 2005 15:04 
You should put it in enCodeBB() . deCodeBB() is used for DEcoding - when editing the message. But for HTML tags, I think, it is not necessary to put something here.

Author Anonymous
Guest
#5 | Posted: 9 Mar 2005 15:58 
Hmm, putting your code in the enCodeBB() function worked, I even made a br variant. I'm still having troubles with the a tag and the img tag... I never used regex before so I guess I'll have to try and try...

Thank you for your help!

Author Team
Guest
#6 | Posted: 9 Mar 2005 16:07 
You don't need to make <br> variant, since all newlines (pressed by "Enter") are automatically converted to <br>.

As about <IMG> tag - in default version, it's much better to use BB code. Because, in general, <img> requries border, alt attributes and it is really hard for usual users.

Author Anonymous
Guest
#7 | Posted: 9 Mar 2005 16:18 
Yes, I know that, but the users are just taking those tests and putting the code in the message. It's that code that contains the html tags, like <br> and <img>. And they don't know all that BB code, they just want to copy/paste...

Here is an example of that code:

<img src="http://someserver.com/blah.gif" border="0" alt="text"><br>somemoretext.
<br><br><a href="http://someserver.com/"> <font size="-1">againsometext</font></a><BR> <font size="-3">some <a href="http://someserver.com">link</a></font>

So all the normal html tags have to be replaced and that's what I'm trying to do now...

Author Team
8-)
#8 | Posted: 9 Mar 2005 16:24 
The main difficulty is that user can enter this information different way. For example:

<img src="http://someserver.com/blah.gif" border="0" alt="text">
<img src="http://someserver.com/blah.gif" border="0">
<img border=0 src="http://someserver.com/blah.gif">
<img src="http://someserver.com/blah.gif" alt="text" border=0>
<img src="http://someserver.com/blah.gif" alt = "text" border = "0">

etc. is the same code for an image, but not the same for the processing script. Probably, you need to handle not the code itself, but just check for opening and closing HTML tags.

Author Anonymous
Guest
#9 | Posted: 9 Mar 2005 16:33 
Yes, I know, but I saw all the code I posted earlier has the same layout, even if it are diffrent tests. So my guess was to put those specific codes in it and it should work for every test.

I tried replacing a regular <img src="blah"> tag with the correct BB code with this in the enCodeBB() :
$pattern[]="/&lt;img src=\"(.+?)\"&gt;/s";
$replacement[]="[img]\\1[/img]";
It won't work though and frankly I don't have any idea what I'm doing/should do with that regex code...

I'm going to read some regex tutorials... Guess I'll need that.

Master Class miniBB Support Forums / Master Class / Pure HTML in posts?.. Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

 ?
Only registered users are allowed to post here. Please, enter your username/password details upon posting a message, or register first.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
 
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Proceed with the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB