Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Loony Tune on March 24, 2011, 05:13:34 PM

Title: Simple question, simple answer?? [SOLVED]
Post by: Loony Tune on March 24, 2011, 05:13:34 PM
I want to ad a border to my table in a post. Normal bb code has "border="1" printed above my table, and in HTML, it just displays the code, not the table



I am running SMF 2 rc5. I had the same problem in SMF 1.1.13, but decided to upgrade, so stated the topic over here.

Any help would be great

Would ad the code I typed, but it just outputs the table

LT  ;)
Title: Re: Simple question, simple answer??
Post by: kat on March 24, 2011, 05:18:25 PM
Try putting the code in... er... code tags.

{code}

Code here

{/code}
Title: Re: Simple question, simple answer??
Post by: Loony Tune on March 24, 2011, 05:23:04 PM
What, like this

{table border="1"}{tr}
{td}{b}Player Name{/b}{/td}
{/td}{/tr}{/table}


And watch it output

{table border="1"}{tr}
{td}{b}Player Name{/b}{/td}
{/td}{/tr}{/table}
Title: Re: Simple question, simple answer??
Post by: Loony Tune on March 24, 2011, 05:23:57 PM
Except without the added {/td} of course
Title: Re: Simple question, simple answer??
Post by: kat on March 24, 2011, 05:26:04 PM
Nope.

Sorry, I should've said.

The curlly brackets should be straight ones.

Quote my post to see this:

Code is here.
Title: Re: Simple question, simple answer??
Post by: Matthew K. on March 24, 2011, 05:32:22 PM
He means [code][/code] tags ;)
Title: Re: Simple question, simple answer??
Post by: Loony Tune on March 24, 2011, 05:37:47 PM
Yes to Labradoodle-360. the code I was using was BB "[]"
Title: Re: Simple question, simple answer??
Post by: Loony Tune on March 24, 2011, 05:38:20 PM
But no border when i add border=1 to the table tag
Title: Re: Simple question, simple answer??
Post by: Loony Tune on March 24, 2011, 06:45:24 PM
And I may as well ask how to algin as well
Title: Re: Simple question, simple answer??
Post by: Arantor on March 24, 2011, 06:48:04 PM
Well, you can't use border=1 in the bbcode. Simple as that. The code in preparsecode() that validates bbcode as valid on saving a post will remove it.

What you can do is modify the <table> output in Subs.php so that it automatically comes with a border but there's no way to make it a parameter without making a lot more modifications to the way parsing is handled, which isn't really recommended for security or performance.
Title: Re: Simple question, simple answer??
Post by: Loony Tune on March 24, 2011, 06:55:54 PM
Cheers Arantor. This was also the suggestion when I used 1.1.13. I looked for the subs.php file, but the file I found made no mention of the <table> tag. Could you tell me where to find it please and I assume it is as simple as adding the border to the tag

LT
Title: Re: Simple question, simple answer??
Post by: Arantor on March 24, 2011, 06:57:03 PM
array(
'tag' => 'table',
'before' => '<table class="bbc_table">',
'after' => '</table>',
'trim' => 'inside',
'require_children' => array('tr'),
'block_level' => true,
),


Or or around line 1522. You can of course style it somewhat with CSS.
Title: Re: Simple question, simple answer??
Post by: Loony Tune on March 24, 2011, 07:01:51 PM
Quote from: Arantor on March 24, 2011, 06:57:03 PM
array(
'tag' => 'table',
'before' => '<table class="bbc_table">',
'after' => '</table>',
'trim' => 'inside',
'require_children' => array('tr'),
'block_level' => true,
),


Or or around line 1522. You can of course style it somewhat with CSS.

Sorry to be a pain, but where would I then specify that the table tag would always have a border? Would it be:

'tag +> 'table border="1"' ,

And where is the file located please.

Thanks

LT
Title: Re: Simple question, simple answer??
Post by: Arantor on March 24, 2011, 07:05:43 PM
No, it would be the 'before' part which is the HTML it generates. ie.

array(
'tag' => 'table',
'before' => '<table class="bbc_table" border="1">',
'after' => '</table>',
'trim' => 'inside',
'require_children' => array('tr'),
'block_level' => true,
),


And the file's in the Sources/ directory.
Title: Re: Simple question, simple answer??
Post by: Loony Tune on March 24, 2011, 07:09:29 PM
Thank you, thank you.

I'll try it and post back
Title: Re: Simple question, simple answer??
Post by: Loony Tune on March 24, 2011, 07:15:06 PM
Just done that. I take it, it only applies to new, not exisiting tables then
Title: Re: Simple question, simple answer??
Post by: Arantor on March 24, 2011, 07:15:43 PM
No, it should apply to all tables created with bbcode.
Title: Re: Simple question, simple answer??
Post by: Loony Tune on March 24, 2011, 07:16:42 PM
Just tried a new topic, and the border was not added. Will check the Subs.php file to make sure there was no snafoo on my part (quite possible)
Title: Re: Simple question, simple answer??
Post by: Loony Tune on March 24, 2011, 07:19:08 PM
Got it. and extra " was what done it.

All working, thanks.

Now, how to I align the data in the cell. I tried align="center', to no avail

Thanks again
Title: Re: Simple question, simple answer??
Post by: Loony Tune on March 24, 2011, 07:19:59 PM
Or for that matter, allocate a % of the table? ie, td="25%"
Title: Re: Simple question, simple answer??
Post by: Arantor on March 24, 2011, 07:23:58 PM
The same problem applies to all of them; not only is the table rewritten, so are tr and td.

You should be able to use [center] inside a td. As for width, no, not possible.

What you may just be best doing is using [html] and writing it in normal HTML. That's admin only for security.
Title: Re: Simple question, simple answer??
Post by: Loony Tune on March 24, 2011, 07:30:26 PM
But html in a post doesn't work. As for
, didn't think of that
Title: Re: Simple question, simple answer??
Post by: Arantor on March 24, 2011, 07:33:51 PM
HTML in a post only works if 1) you're the admin and 2) you use that specific bbcode to put around it to tell the forum to allow it as raw HTML.
Title: Re: Simple question, simple answer??
Post by: Loony Tune on March 24, 2011, 07:35:12 PM
Oh. Well, I am the admin and as for the other bit, where do I start?

Cheers

LT
Title: Re: Simple question, simple answer??
Post by: Arantor on March 24, 2011, 07:38:49 PM
Well...

[html]<table border="1">
<tr>
<td width="25%">content</td><td width="75%">content</td>
</tr>
</table>[/html]

perhaps
Title: Re: Simple question, simple answer??
Post by: Loony Tune on March 24, 2011, 07:47:59 PM
I'll give it a go.

Glad there is someone who knows what they're doing, 'cos it aint me  :)
Title: Re: Simple question, simple answer??
Post by: Arantor on March 24, 2011, 07:49:23 PM
Me, know what I'm doing? I'm an enthusiastic amateur, at least to myself ;) Let me know how it goes though :)
Title: Re: Simple question, simple answer??
Post by: Loony Tune on March 24, 2011, 10:21:47 PM
Al good matey.

Cheers

LT