Jump to content

[HSC] Table BBCode


HeadStand
 Share

Recommended Posts


1) I need to be able to hide the table title line as it is not needed at all.


2) The column does not seem to fit the entire width of the page it is posted on, it seem to be around 3/4 of the total width?


3) Is there a way of turning off the alternate row colours?


4) There seem to be around two lines of empty space above each table?



I'm curious to know how these can be controlled as well.

EDIT: You can edit the BBCode for most of this stuff. I just can't figure out how to get rid of the empty space above the table.
Link to comment
Share on other sites

Well, even after copying the examples above and pasting these in any topic, there's no such thing as a table appearing. Yes I do get table headers, but content is above header, not in table, showing tags and all.

Must be doing something wrong, since others have mentioned this working as a charm, but I could use some explaining as well.

Thanks

Elanor

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...
  • 3 weeks later...

I'm not able to add line breaks within a td, I guess it's a result of the linebreak fix but it makes working with tables rather difficult. Is there anything that can be done about that? Thanks for the mod :smile: .

Fixed, see second edit.

Edit: I commented out the call to stripLineBreaks and got the same result. For example, this code works:

[table]

[tr]

[td]Text1[/td]

[/tr]

[/table]

But this code doesn't:

[table]

[tr]

[td]Text1

Text2[/td]

[/tr]

[/table]

Here, the tr tags are parsed but table and td are not. As far as I can tell, IPB reads the post and parses tags when they are closed, so td first, in this case. I think the td tag is failing to parse becuase of the linespace within it. I'm still looking through the code to see if I can work out the exact cause. It is also possible this is an issue with running on a Windows server? Edit 2: Fixed this. You need to use the PHP tag which counts newline as part of the any character regex match (a dot). To do this, at the end of each regex, change /i to /is. Specifically, in table.php it should say:

$txt = preg_replace("/\[{$_tag}\](.*?)\[\/{$_tag}\]/is", "<table class=&#39;ipb_table&#39;>$1</table>", $txt);

And it td.php it should say:

$txt = preg_replace_callback("/\[{$_tag}(=.*?)?\](.*?)\[\/{$_tag}\]/is", array($this, &#39;_createTableCell&#39;), $txt);



Hope this helps!

Link to comment
Share on other sites

  • 7 months later...
  • 2 weeks later...

Here is an update for _stripLineBreaks.. right now it assumes that there can ONLY be a nr between table, td, tr bbcodes. It's definitely possible with neatly formatted table code including indents to have indents for td tags, tr, etc.

This eats up that whitespace too so br tags aren't generated.



    private function _stripLineBreaks($txt)

    {

	    // Strip line breaks only in between tags, not inside tag content (like table cells)

	    $txt = preg_replace('/[table](<br />[nrs]+)[tr]/i', '[table][tr]', $txt);

	    $txt = preg_replace('/[table](<br />[nrs]+)[th(=d+)?]/i', '[table][th$2]', $txt);

	    $txt = preg_replace('/[/th](<br />[nrs]+)[tr]/i', '[/th][tr]', $txt);

	    $txt = preg_replace('/[/th](<br />[nrs]+)[th(=d+)?]/i', '[/th][th$2]', $txt);

	    $txt = preg_replace('/[tr](<br />[nrs]+)[td(d)?]/i','[tr][td$2]',$txt);

	    $txt = preg_replace('/[/td(d)?](<br />[nrs]+)[td(d)?]/i','[/td$1][td$3]',$txt);

	    $txt = preg_replace('/[/td(d)?](<br />[nrs]+)[/tr]/i','[/td$1][/tr]',$txt);

	    $txt = preg_replace('/[/tr](<br />[nrs]+)[tr]/i','[/tr][tr]',$txt);

	    $txt = preg_replace('/[/tr](<br />[nrs]+)[/table]/i','[/tr][/table]',$txt);

	    return $txt;

    }


Link to comment
Share on other sites

  • 2 weeks later...

Someone knows how to fix empty space before table?

post-362298-0-22850400-1338452664_thumb.

I am using this code


[table][th] # [/th]		  [th] PLAYER [/th]		 [th] FINAL MATCH [/th]		 [th] PLAYER [/th]

[tr] [td=10] M16 [/td] [td] _______w13_______ [/td] [td] _score_ [/td] [td] _______w14_______ [/td] [/tr]

[th] # [/th]		  [th] PLAYER [/th]		 [th] 1/2 MATCHES [/th]		 [th] PLAYER [/th]

[tr] [td] M14 [/td] [td] _______w11_______ [/td] [td] _score_ [/td] [td] _______w12_______ [/td] [/tr]

[tr] [td] M13 [/td] [td] _______w09_______ [/td] [td] _score_ [/td] [td] _______w10_______ [/td] [/tr]

[th] # [/th]		  [th] PLAYER [/th]		 [th] 1/4 MATCHES [/th]		 [th] PLAYER [/th]

[tr] [td] M12 [/td] [td] _______w07_______ [/td] [td] _score_ [/td] [td] _______w08_______ [/td] [/tr]

[tr] [td] M11 [/td] [td] _______w05_______ [/td] [td] _score_ [/td] [td] _______w06_______ [/td] [/tr]

[tr] [td] M10 [/td] [td] _______w03_______ [/td] [td] _score_ [/td] [td] _______w04_______ [/td] [/tr]

[tr] [td] M09 [/td] [td] _______w01_______ [/td] [td] _score_ [/td] [td] _______w02_______ [/td] [/tr]

[/table]





Another question is what does mean the number inside tags? [td=25], [td=75]
I thought it's space in px or % of space in table, but it's not working for me as I expect.

Link to comment
Share on other sites

  • 3 weeks later...

After updating to 3.3.3 table an I have the problem of line break inside of the cell. This is normal?
What I need to do to have it working just like it was in 3.3.1?

I think the function

private function _stripLineBreaks($txt)



Is no longer compatible with 3.3.3 Could you test it?

Link to comment
Share on other sites

  • 4 weeks later...
  • 4 weeks later...
  • 1 month later...
  • 1 month later...
  • 4 weeks later...

Can anyone apply those changes and upgrade new file here, possibly author, please. Or if someone did it already please P.M. me.

I haven't had much luck upgrading it to 3.4.. man bbcode is hosed. It took me forever to get some other custom bbcodes upgraded.

here u go (´・ω・`)

this is my modified version for 3.4.x, until OP has time to release his official update

just upload the files, if u have the xml imported alrdy, tested working fine

ultra_unofficial_TableBBCode_by_Eudemon.zip

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...