Advertisement:

Author Topic: How to allow more HTML tag in post?  (Read 33036 times)

Offline dvc102

  • Newbie
  • *
  • Posts: 5
How to allow more HTML tag in post?
« 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.
« Last Edit: June 05, 2008, 05:46:46 AM by dvc102 »

Offline karlbenson

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,629
  • Gender: Male
    • Criminal Brief UK
Re: How to allow more HTML tag in post?
« Reply #1 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.

Offline N3RVE

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,907
  • Gender: Male
    • N3RVE.COM
Re: How to allow more HTML tag in post?
« Reply #2 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".
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

Offline greyknight17

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 14,890
  • Gender: Male
    • Kevin's Resource Center
Re: How to allow more HTML tag in post?
« Reply #3 on: June 07, 2008, 05:39:10 PM »
dvc102, is this issue resolved?

Offline skoville

  • Semi-Newbie
  • *
  • Posts: 12
Re: How to allow more HTML tag in post?
« Reply #4 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?

Offline tatore

  • Sophist Member
  • *****
  • Posts: 1,259
  • Gender: Male
    • salvo.franchina on Facebook
    • @tatore on Twitter
    • SalvoFranchina.it
Re: How to allow more HTML tag in post?
« Reply #5 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] ? ;)
*Salvo*




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

Offline tatore

  • Sophist Member
  • *****
  • Posts: 1,259
  • Gender: Male
    • salvo.franchina on Facebook
    • @tatore on Twitter
    • SalvoFranchina.it
Re: How to allow more HTML tag in post?
« Reply #6 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]
*Salvo*




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

Offline skoville

  • Semi-Newbie
  • *
  • Posts: 12
Re: How to allow more HTML tag in post?
« Reply #7 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
« Last Edit: June 15, 2008, 10:01:10 AM by skoville »

Offline tatore

  • Sophist Member
  • *****
  • Posts: 1,259
  • Gender: Male
    • salvo.franchina on Facebook
    • @tatore on Twitter
    • SalvoFranchina.it
Re: How to allow more HTML tag in post?
« Reply #8 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: [?]
*Salvo*




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

Offline skoville

  • Semi-Newbie
  • *
  • Posts: 12
Re: How to allow more HTML tag in post?
« Reply #9 on: June 15, 2008, 10:26:42 PM »
Thanks for your time, tatore.
Yes I have resize unchecked. This is what I mean.

Offline skoville

  • Semi-Newbie
  • *
  • Posts: 12
Re: How to allow more HTML tag in post?
« Reply #10 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.

Offline lucidlogic

  • Semi-Newbie
  • *
  • Posts: 11
Re: How to allow more HTML tag in post?
« Reply #11 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?
« Last Edit: July 19, 2008, 09:30:23 PM by lucidlogic »

Offline lucidlogic

  • Semi-Newbie
  • *
  • Posts: 11
Re: How to allow more HTML tag in post?
« Reply #12 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
« Last Edit: July 19, 2008, 10:03:19 PM by lucidlogic »

Offline coldarif

  • Semi-Newbie
  • *
  • Posts: 40
  • Gender: Male
    • jobsdhaka.com
Re: How to allow more HTML tag in post?
« Reply #13 on: July 26, 2009, 02:58:42 AM »
wow thats grate.....

Offline HunterP

  • Sr. Member
  • ****
  • Posts: 976
  • Gender: Male
  • SMF 2.0.4
    • Hulpverleningsforum Nederland
Re: How to allow more HTML tag in post?
« Reply #14 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?

Oya

  • Guest
Re: How to allow more HTML tag in post?
« Reply #15 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

Offline HunterP

  • Sr. Member
  • ****
  • Posts: 976
  • Gender: Male
  • SMF 2.0.4
    • Hulpverleningsforum Nederland
Re: How to allow more HTML tag in post?
« Reply #16 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?

Oya

  • Guest
Re: How to allow more HTML tag in post?
« Reply #17 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

Offline HunterP

  • Sr. Member
  • ****
  • Posts: 976
  • Gender: Male
  • SMF 2.0.4
    • Hulpverleningsforum Nederland
Re: How to allow more HTML tag in post?
« Reply #18 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?

Oya

  • Guest
Re: How to allow more HTML tag in post?
« Reply #19 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