News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Simple question, simple answer?? [SOLVED]

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

Previous topic - Next topic

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.

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.

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.

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.

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%"

Advertisement: