XMB Forum Software

[Answered] BBcode tables

mjavado - 7-1-2012 at 07:03 PM

One question, one suggestion:
- Is it possible to include tables to the BBcode supported by XMB, so the output this site gives you can be used?
- Perhaps it is even a good idea to add this very option to the bar just above the typing box while typing a reply.

Regards,

Marijn

Mouser - 7-1-2012 at 08:44 PM

Hi Martijn,

Those tags van be easily added to be used.
Adding them in the bar above the typing box, takes some more effort.



If you want very basic support..
Check out these two images.
This is file ./include/functions.php

Added to the first image, was line;
543-545
561-563


Added to the first image, were lines;
621-623
658-660

And a comma at the end of the lines before that 619/656


1.png - 26kB2.png - 93kB

mjavado - 7-2-2012 at 11:40 AM

If I do this and generate a test table, my input is this

Code:
[table] [tr] [th]Test 1[/th] [th]Test 2[/th] [th]Test 3[/th] [/tr] [tr] [td]1'1[/td] [td]1'2[/td] [td]1'3[/td] [/tr] [tr] [td]2'1[/td] [td]2'2[/td] [td]2'3[/td] [/tr] [/table]


But at the forum, it turns out to be this
Code:
[/table] [/tr] [/th]Test 1[/th] [/th]Test 2[/th] [/th]Test 3[/th] [/tr] [/tr] [td]1'1[/td] [td]1'2[/td] [td]1'3[/td] [/tr] [/tr] [td]2'1[/td] [td]2'2[/td] [td]2'3[/td] [/tr] [/table]


I added an extra line to the triplet you added, taking [td] in account. Afterwards, the output was
Code:
[/table] [/tr] [/th]Test 1[/th] [/th]Test 2[/th] [/th]Test 3[/th] [/tr] [/tr] [/td]1'1[/td] [/td]1'2[/td] [/td]1'3[/td] [/tr] [/tr] [/td]2'1[/td] [/td]2'2[/td] [/td]2'3[/td] [/tr] [/table]


I guess this means that I now successfully made my forum replace [table], [tr], [th] and [td] into their [/...] counterparts.

I have tried replacing lines 658-660 as seen in picture 2 without the '/', with the result that my input was indeed the output. No table showed up, however...

After replacing the lines 658-660 with their <> counterparts, I saw some improvement, but my entire lay-out was changed.
Afterwards, I put the following in the file, instead of what you proposed in picture 2:

Code:
Under the //Replace simple tags, around your lines 621-623 29 => '[/rquote]', 30 => '[table]', 31 => '[tr]', 32 => '[th]', 33 => '[td]', 34 => '[/table]', 35 => '[/tr]', 36 => '[/th]', 37 => '[/td]', );

Code:
Around your lines 658-660 29 => ' </td></tr></table><font class="mediumtxt">', 30 => '<table>', 31 => '<tr>', 32 => '<th>', 33 => '<td>', 34 => '</table>', 35 => '</tr>', 36 => '</th>', 37 => '</td>', );


This yielded the desired result. However, there were some blank lines above the table.

Thanks for your support. Thanks to these pictures and a good look at the file, I now understand how to create these BBCode commands.

This leaves me with one question
Is there any way to remove the blank lines above the tables created this way? If neccessary, I will upload the functions.inc.php file I use now.

Regards,

Marijn Jansen van Doorn

Mouser - 7-2-2012 at 04:46 PM




I see the mistakes now ... My apolegies. I slept less then 8 hours in the entire weekend.
Please attach your functions.inc.php and i'll check it out :)

mjavado - 7-2-2012 at 06:04 PM

Here it is. It's fully working except for the blank lines. I also noticed the table most of the time getting at the bottom of a post, before the signature.
Thanks for your support. I'm happy your mistakes thaught me something :D.

Regards,

Marijn

Attachment: functions_including_table.inc.php (85kB)
This file has been downloaded 234 times

Mouser - 7-2-2012 at 08:57 PM

Tested it on my own board this time :) Should work now.

[Attachment removed; old file]


Always good if you learn something :D

mjavado - 7-2-2012 at 09:50 PM

It does not make any difference if I use your file, actually. I have replaced the file, this file being the only edited file in the installed forum. I'll try some more.

Edit:
I think it's weird that the 'quote' code does not behave this way. The <NOBR> does not solve the problem with my tables.

Since I added some other BBcodes, I'll upload that file as well. I don't see how the other lines would interfere, as not having these lines generates the same results. Maybe I'm wrong though.

Attachment: functions_all.inc.php (85kB)
This file has been downloaded 222 times

Mouser - 7-3-2012 at 04:34 PM

When I used the file I attached... I saw no extra line breaks anymore.
But I can see what happened, some of my changes were removed.

How does this work for ya ?
Screenshot perhaps , and the content of your post attached here as a TXT file ?

[Attachment removed; old file]

mjavado - 7-3-2012 at 04:53 PM

With your functions.inc.php I get this result. The code is posted above my example, as per explanation on my forum. No blank rules are between them. AND the table is closed with [/table].

I don't see any differences, actually...

the entire visible part, with [ code ] replaced...:
Code:
[code d] [table] [tr] [th]Eerste kolom[/th] [th]Tweede kolom[/th] [/tr] [tr] [td]Dit is de eerste cel van de eerste rij[/td] [td]Dit is de tweede cel van de eerste rij[/td] [/tr] [tr] [td]Dit is de eerste cel van de tweede rij[/td] [td]Dit is de tweede cel van de tweede rij[/td] [/tr] Wordt [/code d] [table] [tr] [th]Eerste kolom[/th] [th]Tweede kolom[/th] [/tr] [tr] [td]Dit is de eerste cel van de eerste rij[/td] [td]Dit is de tweede cel van de eerste rij[/td] [/tr] [tr] [td]Dit is de eerste cel van de tweede rij[/td] [td]Dit is de tweede cel van de tweede rij[/td] [/tr] [/table] Het enige probleem met deze tabel is het volgende: hij komt vaak ineens onderaan de post. Ik typ dit namelijk in de post ONDER de tabel... Maargoed, ik heb de designer van het forum gecontacteerd over dit probleem, inclusief de witregels die altijd ontstaan.


Knipsel.PNG - 164kB

mjavado - 7-3-2012 at 04:57 PM

Another set, this time with a .txt post.

Also, what changes did you make?

Attachment: knipsel2.txt (2kB)
This file has been downloaded 197 times

Knipsel2.PNG - 117kB

Mouser - 7-3-2012 at 09:05 PM

This is how it looks like on my own board.

Could you save me the HTML source of the page you are viewing?
Maybe I can see something there...

Capture.PNG - 67kB

mjavado - 7-3-2012 at 11:48 PM

It looks perfect! Why can't it at my forum... ?
I have copied the source HTML

Attachment: HTML of page.txt (94kB)
This file has been downloaded 158 times


Mouser - 7-4-2012 at 03:10 PM

I'm quite surprised how you can receive that HTML output with the functions.inc.php I provided. Because something that is in there, should have been filtered out by the file I've uploaded.
Could you provide me with the file you're using right now?
I'd like to check :) Thank you

mjavado - 7-4-2012 at 05:33 PM

I don't quite understand what you mean. Am I to rightclick and 'save page as'?
In that case: here it is, including a .rar of the files the browser saved with it.

If not, what file shoud I upload?

Attachment: viewthread.php (101kB)
This file has been downloaded 157 times

Attachment: viewthread_bestanden.rar (120kB)
This file has been downloaded 16 times


Mouser - 7-4-2012 at 07:19 PM

De HTML die je vanacht poste was precies wat ik wilde zien hoor :)

Maar daar staat iets in, dat eigenlijk weg gefilterd had moeten zijn door de functions.inc.php (tenminste, in die wat ik als laatste gepost heb)

Daarom zou ik graag eens willen zien welke functions.inc.php je nu live gebruikt op je forum ;)


Want ik begin het nu niet meer te snappen :D

mjavado - 7-4-2012 at 08:27 PM

Ah, Nederlands!

Ok ik upload 'm nu.
Ik heb niet zo kunnen zien waar je de veranderingen had gemaakt.

Attachment: functions.inc.php (85kB)
This file has been downloaded 251 times

Mouser - 7-6-2012 at 10:06 AM

Ik zie al waarom het niet werkt. Je gebruikt niet het bestand dat ik telkens upload :P

Hernoem je bestand naar "functions.inc.php.bck" bijvoorbeeld.
Upload dan dit hier :)

[Attachment removed; old file]

mjavado - 7-6-2012 at 04:02 PM

De witregels staan er nog steeds. Ik heb de file die jij hier gepost hebt gebruikt, maar ik zie geen verschil.

Knipsel.PNG - 69kB

Mouser - 7-8-2012 at 09:00 PM

Het is weekend geweest, dan ben ik nooit online :)

Kun je de HTML source eens posten van dat wat ik daar zie ?Thx!

mjavado - 7-10-2012 at 10:58 AM

Bij dezen

Attachment: HTMLvoorbeeld.rar (131kB)
This file has been downloaded 15 times


Mouser - 7-10-2012 at 04:03 PM

Ik word er gek van :|
Pak deze eens. Als dat niet werkt, dan ben ik even ten einde raad :O

Heb me eens aangemeld op je forum... Live checken.

[Attachment removed; old file]

mjavado - 7-14-2012 at 04:52 PM

You, sir, are a hero :P.
Nu doet-ie het. Misschien vorige upload toch per ongeluk een oude file? Kan gebeuren

Mouser - 7-15-2012 at 09:21 PM

Pfew. Great to hear :D

Hehe, took some time but we got it.

mjavado - 7-15-2012 at 09:25 PM

Well, in the end some posts or rather subfora still suffer from the <br /> problem...
As you are a member on my forum, you can see for yourself.

Mouser - 7-15-2012 at 10:03 PM

Hmm, could you send me an example link ?

mjavado - 7-16-2012 at 08:59 AM

I've noticed that entering decks from Safari introduces the [br] problem, while entering from Firefox doesn't (at least, during last tries...). However, when editting, any [br] in the post can't be removed.
This is an example

Mouser - 7-23-2012 at 09:59 PM

Hmm, just for fun... :) Try this one please ?



Attachment: functions.inc.php (86kB)
This file has been downloaded 120 times


mjavado - 7-24-2012 at 09:44 AM

It has been uploaded, but doesn't seem to work. Does not have any unwanted effects as far as Ii can see though.

Mouser - 7-24-2012 at 04:34 PM

Made a typo :$ Please re-download it.

mjavado - 8-23-2012 at 03:33 PM

still no luck, are you sure it is the right file in te post above my last?

mjavado - 8-23-2012 at 05:00 PM

I found out that the GUI I wrote produced a space (as in, space bar) after each ']' when copied with some browsers. When I replaced all ]-space instances with just ], everything worked out!

mjavado - 8-23-2012 at 06:07 PM

Right. I fixed it. Tried adding some more BB commands with space included at the end, like '[tr] ', but that didn't work. Now I let the script replace '[tr] ' in '[tr]' and so on, before the BBcodes are replaced within the message. Crude, but it works. Working version included.

Attachment: NEWfunctions.inc.php (87kB)
This file has been downloaded 114 times