News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

How to allow more HTML tag in post?

Started by dvc102, June 05, 2008, 05:37:38 AM

Previous topic - Next topic

dvc102

Dear All
I want to allow more HTML tag. How can I do? Which files I have to change?
I've searched about this problem many times  but did not found the result.
Please help me,  Thanks.

karlbenson

Admins can use [html][/html] bbcoe to use html in a post.

However for security reasons other users CAN'T use it as it would be a severe security risk. That is why bbcode was developed in the first place.

N3RVE

Quote from: karlbenson on June 05, 2008, 01:42:29 PM
However for security reasons other users CAN'T use it as it would be a severe security risk.

But if SMF Forum Administrators still want to enable Basic HTML in Post.
It can be done from;

Admin Control Panel -> Post and Topics -> Bulletin Board Code tab and check "Enable basic HTML in posts".
Ralph "[n3rve]" Otowo
Former Marketing Co-ordinator, Simple Machines.
ralph [at] simplemachines [dot] org                       
Quote"Somewhere, something incredible is waiting to be known." - Carl Sagan

greyknight17


skoville

Well, my head hurts from pulling my hair out. I keep searching and reading that Admins can post html. Not until I enabled "Enable basic HTML in posts". was I able to use html.  So I must have another problem, because I cannot get an add link banner to work in my sig. I am missing another setting?

tatore

isn't easier to use img tags, like:

[img]http://www.example.net/image.jpg[/img] ? ;)
*Salvo*




Quote from: Rumbaar
I wont jump to conclusion, but you might be hacked?

tatore

or, for a linkable image:


[url=http://www.the_site_that_image_open.net][img]http://www.example.net/image.jpg[/img]
[/url]
*Salvo*




Quote from: Rumbaar
I wont jump to conclusion, but you might be hacked?

skoville

#7
Yes, I would think so, but
Quoteimg width=90 height=32]http://img.xxxxxxxxx.com/488x160/1.jpg [nofollow][/img
comes out the size of a postage stamp. Unreadable. Thought using html would help. Not found of things not working the way they should. Know what I mean? Just makes you wonder what's wrong. LOL

tatore

I, maybe, didn't understand your meaning, forgive me for this.
You say that even if you post an image into your sig, it automatically comes displayed as a stamp?
Did you uncheck from:
Admin Control Panel>>>Attachments and avatars>>>Resize images when showing under posts: [?]
*Salvo*




Quote from: Rumbaar
I wont jump to conclusion, but you might be hacked?

skoville

Thanks for your time, tatore.
Yes I have resize unchecked. This is what I mean.

skoville

Thanks, tatore! Your url example is what I needed. No idea why it didn't work yesterday, but alls well today. Too tired or old or both. LOL
  Thanks.

lucidlogic

#11
Everyone here ignored the original poster's question. I've noticed that not all basic HTML is being included.

It appears that <p>, <ul>, <li>, <strong>, and character codes like &nbsp; are being ignored.

What can I do to add this allowed basic html type to my forum?

lucidlogic

#12
Solution for adding more tags:

in Sources/Subs.php around line 1724

$closable_tags = array('b', 'u', 'i', 's', 'em', 'ins', 'del', 'pre', 'blockquote', 'p', 'ul', 'li', 'strong');

How to add recognition of character codes I'm not yet sure. That may just require a substitution table.

UPDATE: I think the recognition of character codes, at least inside anchor tags, should be accomplished inside Subs-Post.php


HunterP

Quote from: lucidlogic on July 19, 2008, 09:51:26 PM
Solution for adding more tags:

in Sources/Subs.php around line 1724

$closable_tags = array('b', 'u', 'i', 's', 'em', 'ins', 'del', 'pre', 'blockquote', 'p', 'ul', 'li', 'strong');

I have a question regarding above addition.

On 'my' forum (I'm not the admin), I'd like to post tables with a unique CLASS or ID so they can be styled with CSS. The admin allows me to make changes to the CSS, so that's no problem.

At the moment, there are buttons which enable all users to post table/tr/td tags in BBcode format. But additional tags such as CLASS and ID are ignored.

Can someone tell me how this can be enabled?

Oya

basically it can't because table/tr/td are protected against missing tags which will break when you add those other things in

HunterP

Quote from: Oya on October 05, 2010, 02:35:47 PMbasically it can't because table/tr/td are protected against missing tags which will break when you add those other things in

Ok, what I'd like to do is post these kind of tables :

03:12:00 06-10-10 TODAY This cell contains some text

When the text becomes longer, time and date break up :

03:12:00 06-10-10 TODAY This is an example of a longer text, which will continue on the next line and will case the first cell (time/date) to break up; the date will move to the next line, and that's just what I don't want :( let's make it just a bit longer, for those with a wide screen or just a high resolution

The timestamp needs to stay on one line, just like in the first example. My thought was to use the "white-space: no-break;" property, but that should only be used for the first column. Furthermore, I'd like different margins between the three columns. Two problems which could be solved by giving the columns its own CLASS or ID. Also, I'd like to handle the table in a posting differently from all the tables on the rest of forum. For this I use "div.post table" in the CSS. This works, but only in the final posting. Not in a preview or in a private message. A unique table CLASS would also fix this.

Ideas, anyone?

Oya

you could, i suppose, modify subs.php where it converts the table to <table> and add a class there for your tables but that's about it - certainly nothing in the bbcode side without a serious amount of rewriting

HunterP

Quote from: Oya on October 05, 2010, 10:28:46 PMyou could, i suppose, modify subs.php where it converts the table to <table> and add a class there for your tables but that's about it - certainly nothing in the bbcode side without a serious amount of rewriting

Ok, I've modified the parse_bbc() function, array $codes in Subs.php, and added this :


array(
'tag' => 'table',
'type' => 'unparsed_equals',
'before' => '<table class="$1">',
'after' => '</table>',
'require_children' => array('tr'),
'block_level' => true,
),
array(
'tag' => 'td',
'type' => 'unparsed_equals',
'before' => '<td id="$1">',
'after' => '</td>',
'require_parents' => array('tr'),
'trim' => 'outside',
'block_level' => true,
'disabled_before' => '',
'disabled_after' => '',
),


Not 100% sure if it's all correct, but it works.

Little problem in $mistake_fixes in Subs-Post.php, where it tries to correct missing tags, since [ table ] can now also be [table=class]. Had to comment some lines to get it all working, but ofcourse these lines also need to be fixed :

// Find [tr]s not followed by [td].
// '~\[tr\](?![\s' . $non_breaking_space . ']*\[td\])~s' . ($context['utf8'] ? 'u' : '') => '[tr][td]',
// Find [/td]s not followed by something valid.
// '~\[/td\](?![\s' . $non_breaking_space . ']*(?:\[td\]|\[/tr\]|\[/table\]))~s' . ($context['utf8'] ? 'u' : '') => '[/td][/tr]',
// Any remaining [tr]s should have a [table] before them.
// '~\[tr\]~s' => '[table][tr]',


Three lines need to be commented to get it working.

First line, [ td ] can also be [td=id]
Second line, [ td ] can also be [td=id]
Third line, [ table ] can also be [table=class]


The id and class properties are examples, these can be anything. I'm not really into PHP-variables, but I need to change the code into something which also accepts [table=*].

Any help, please?

Oya

see this is the part i was telling you would be trouble especially now since if users dont get the tags right it'll break the layout too and im not strong enough with regular expressions to fix this

Advertisement: