Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Topic started by: dvc102 on June 05, 2008, 05:37:38 AM

Title: How to allow more HTML tag in post?
Post by: dvc102 on June 05, 2008, 05:37:38 AM
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.
Title: Re: How to allow more HTML tag in post?
Post by: karlbenson on June 05, 2008, 01:42:29 PM
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.
Title: Re: How to allow more HTML tag in post?
Post by: N3RVE on June 05, 2008, 02:00:13 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".
Title: Re: How to allow more HTML tag in post?
Post by: greyknight17 on June 07, 2008, 05:39:10 PM
dvc102, is this issue resolved?
Title: Re: How to allow more HTML tag in post?
Post by: skoville on June 15, 2008, 09:20:10 AM
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?
Title: Re: How to allow more HTML tag in post?
Post by: tatore on June 15, 2008, 09:25:31 AM
isn't easier to use img tags, like:

Code: [Select]
[img]http://www.example.net/image.jpg[/img] ? ;)
Title: Re: How to allow more HTML tag in post?
Post by: tatore on June 15, 2008, 09:33:45 AM
or, for a linkable image:

Code: [Select]
[url=http://www.the_site_that_image_open.net][img]http://www.example.net/image.jpg[/img]
[/url]
Title: Re: How to allow more HTML tag in post?
Post by: skoville on June 15, 2008, 09:58:31 AM
Yes, I would think so, but
Quote
img width=90 height=32]http://img.xxxxxxxxx.com/488x160/1.jpg[/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
Title: Re: How to allow more HTML tag in post?
Post by: tatore on June 15, 2008, 12:04:42 PM
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: [?]
Title: Re: How to allow more HTML tag in post?
Post by: skoville on June 15, 2008, 10:26:42 PM
Thanks for your time, tatore.
Yes I have resize unchecked. This is what I mean.
Title: Re: How to allow more HTML tag in post?
Post by: skoville on June 17, 2008, 12:24:20 AM
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.
Title: Re: How to allow more HTML tag in post?
Post by: lucidlogic on July 19, 2008, 09:18:31 PM
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?
Title: Re: How to allow more HTML tag in post?
Post by: lucidlogic on July 19, 2008, 09:51:26 PM
Solution for adding more tags:

in Sources/Subs.php around line 1724

Code: [Select]
$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
Title: Re: How to allow more HTML tag in post?
Post by: coldarif on July 26, 2009, 02:58:42 AM
wow thats grate.....
Title: Re: How to allow more HTML tag in post?
Post by: HunterP on October 05, 2010, 01:59:34 PM
Solution for adding more tags:

in Sources/Subs.php around line 1724

Code: [Select]
$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?
Title: Re: How to allow more HTML tag in post?
Post by: Oya on October 05, 2010, 02:35:47 PM
basically it can't because table/tr/td are protected against missing tags which will break when you add those other things in
Title: Re: How to allow more HTML tag in post?
Post by: HunterP on October 05, 2010, 09:22:21 PM
basically 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?
Title: Re: How to allow more HTML tag in post?
Post by: Oya on October 05, 2010, 10:28:46 PM
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
Title: Re: How to allow more HTML tag in post?
Post by: HunterP on October 13, 2010, 04:39:38 PM
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

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


Code: [Select]
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 :

Code: [Select]
// 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?
Title: Re: How to allow more HTML tag in post?
Post by: Oya on October 13, 2010, 05:03:01 PM
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
Title: Re: How to allow more HTML tag in post?
Post by: HunterP on October 13, 2010, 05:19:23 PM
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

Ok :)

The question is whether SMF really needs to try and fix user problems. If one doesn't know how to use the tags correctly, then don't. I'll try to fix these three lines, but I don't think it's a big deal if it stays the way it is.
Title: Re: How to allow more HTML tag in post?
Post by: Shrink on December 18, 2012, 04:05:24 AM
Can i post following hml code.
Code: [Select]
<span class="imdbRatingPlugin" data-user="ur37096939" data-title="tt2188749" data-style="p5"><a href="http://www.imdb.com/title/tt2188749/?ref_=plg_rt_1">IMDb </a></span><script>(function(d,s,id){var js,stags=d.getElementsByTagName(s)[0];if(d.getElementById(id)){return;}js=d.createElement(s);js.id=id;js.src="http://g-ec2.images-amazon.com/images/G/01/imdb/plugins/rating/js/rating.min.js";stags.parentNode.insertBefore(js,stags);})(document,'script','imdb-rating-api');</script>