• Welcome to Simple Machines Community Forum. Please login or sign up.
September 20, 2021, 02:10:45 PM

News:

SMF 2.0.18 has been released! Please update. Read more.


Simple question, simple answer?? [SOLVED]

Started by Loony Tune, March 24, 2011, 05:13:34 PM

Previous topic - Next topic

Loony Tune

March 24, 2011, 05:13:34 PM Last Edit: March 25, 2011, 08:18:42 PM by Loony Tune
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  ;)

kat

Try putting the code in... er... code tags.

{code}

Code here

{/code}

Loony Tune

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}

Loony Tune

Except without the added {/td} of course

kat

Nope.

Sorry, I should've said.

The curlly brackets should be straight ones.

Quote my post to see this:

Code is here.

Matthew K.


Loony Tune

Yes to Labradoodle-360. the code I was using was BB "[]"

Loony Tune

But no border when i add border=1 to the table tag

Loony Tune

And I may as well ask how to algin as well

Arantor

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.
No good deed goes unpunished
All helpful urges should be circumvented

Loony Tune

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

Arantor

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.
No good deed goes unpunished
All helpful urges should be circumvented

Loony Tune

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

Arantor

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.
No good deed goes unpunished
All helpful urges should be circumvented

Loony Tune

Thank you, thank you.

I'll try it and post back

Loony Tune

Just done that. I take it, it only applies to new, not exisiting tables then

Arantor

No, it should apply to all tables created with bbcode.
No good deed goes unpunished
All helpful urges should be circumvented

Loony Tune

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)

Loony Tune

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

Loony Tune

Or for that matter, allocate a % of the table? ie, td="25%"

Arantor

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.
No good deed goes unpunished
All helpful urges should be circumvented

Loony Tune

But html in a post doesn't work. As for
, didn't think of that

Arantor

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.
No good deed goes unpunished
All helpful urges should be circumvented

Loony Tune

Oh. Well, I am the admin and as for the other bit, where do I start?

Cheers

LT

Arantor

Well...

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

perhaps
No good deed goes unpunished
All helpful urges should be circumvented

Loony Tune

I'll give it a go.

Glad there is someone who knows what they're doing, 'cos it aint me  :)

Arantor

Me, know what I'm doing? I'm an enthusiastic amateur, at least to myself ;) Let me know how it goes though :)
No good deed goes unpunished
All helpful urges should be circumvented

Loony Tune


Advertisement: