QB64 Phoenix Edition
tables in forums editor? - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11)
+--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2)
+--- Thread: tables in forums editor? (/showthread.php?tid=2756)

Pages: 1 2 3 4 5


RE: tables in forums editor? - madscijr - 05-31-2024

(05-31-2024, 08:25 PM)Kernelpanic Wrote: The thing with the tables in HTML doesn't work. Or there is some kind of limitation. I can't undo this mess? Huh

OK, now it's gone. 
[Image: icon-machinegun.gif]
It's not exactly html, since you use square brackets [ ]  instead of < >. 
But I think you need to be in code view when you add your table - click the page looking icon, the very last icon on the toolbar.


RE: tables in forums editor? - Kernelpanic - 05-31-2024

Quote:It's not exactly html, since you use square brackets [ ]  instead of < >. 
Yes, I did, but it was absolute chaos!

Quote:But I think you need to be in code view when you add your table - click the page looking icon, the very last icon on the toolbar.
So, it doesn't work.

[Image: Table2024-05-31-231219.jpg]


RE: tables in forums editor? - SMcNeill - 05-31-2024

(05-31-2024, 09:14 PM)Kernelpanic Wrote:
Quote:It's not exactly html, since you use square brackets [ ]  instead of < >. 
Yes, I did, but it was absolute chaos!

Quote:But I think you need to be in code view when you add your table - click the page looking icon, the very last icon on the toolbar.
So, it doesn't work.

[Image: Table2024-05-31-231219.jpg]
I can verify 100% that it's not going to work the way you're trying to make it work.  Big Grin

From your screenshot, it appears that you've basically written html and then decided, "Hey, all I need to do is swap [] for <>, and then it'll work!"  

Gosh, if we could just do that and convert from QB64PE to PYTHON, and back!!   Tongue

HTML is one distinct language.  What the forums are using is MYCODE -- a completely different language; though as you can tell, they look fairly similar at first glance.

What you want to do is go take a look over at the mybb site and see what MYCODE supports naturally:  https://docs.mybb.com/1.6/MyCode/

bold[ b ]  [ /b ]
italic [ i ]  [ /i ]
underline [ u ] [ /u ]
strikethrough [ s ] [ /s ]
URL [ url ]http://url.com[/url]
[ url=http://url.com ]My URL[ /url ]
email [ email ]myemail@mydomain.com[ /email ]
[ email=myemail@mydomain.com ]My Email[ /email ]
quote [ quote ][ /quote ]
[ quote=Author][ /quote ]
code [ code ]  [ /code ]
[ php ] [ /php ]
image[ img ]http://mysite.com/mypic.jpg[ /img ]
font color [ color=red ][ /color ]
font size[ size=3 ][ /size ]
font face[ font=tahoma ][ /font ]
text alignment[ align=center ][ /align ]
listing [ list ][ /list ] and [ * ]


Now, as you can see from the table I placed above, tables DO work for us.  Wink

As you can also see, there are quite a few HTML commands which you were trying to use in your image that aren't the least bit supportted.  There's no <cite>.  Why would you even want a <br>, when a post just uses ENTER to designate the end of a line and move down to the next one??

If you also notice, there's no mention of any of the table commands in the list above, either.

Why??

Because those are the standard MYCODE commands, which you'll find supported with all versions of the mybb forum software.   [ table ] doesn't happen to be one of those commands.

Then how the BLEEP do we have a [ table ] command??

Because there's such a thing as CUSTOM MYCODE, which the admin of each site writes and adds to help expand what a user can do with the forums -- and our admin wrote in a custom mycode for [ table ].

Well, shucks, that was mighty nice of them!!

You're welcome.  All you have to do is follow the syntax for the commands as we created them, and you can use those table commands all you want now!

Well, WTF is the syntax for those commands???

That was already covered HERE.  As you can see, there's no reference to cellpadding, alignment, or anything like that...  Just a simple:

[ table=### ]  [ /table ]
[ tr ]  [ /tr]
[ td ]  [ /td ]
[ th ]  [ /th ]

Use the proper syntax, and you can use those commands.   Otherwise...   Things can get all screwed up, as you mentioned in your own post already.  Wink


RE: tables in forums editor? - SMcNeill - 05-31-2024

(05-31-2024, 08:39 PM)madscijr Wrote: But I think you need to be in code view when you add your table - click the page looking icon, the very last icon on the toolbar.

You don't have to be in code view for it to work.

You just have to use the proper formatting and not screw it up. Wink


RE: tables in forums editor? - madscijr - 06-01-2024

(05-31-2024, 09:14 PM)Kernelpanic Wrote:
Quote:It's not exactly html, since you use square brackets [ ]  instead of < >. 
Yes, I did, but it was absolute chaos!
Don't give up, just use the tags at the site Steve posted:

https://docs.mybb.com/1.6/MyCode/


RE: tables in forums editor? - Kernelpanic - 06-01-2024

Quote:Don't give up, just use the tags at the site Steve posted:
[Image: Sisyphus.gif] 

OK, I tried something - it worked, but the behavior was a bit strange.
Is there a way to test it offline in a browser? I couldn't find anything in the descriptions, and with [. . .] it doesn't work in the browser.

The Zündapp KS 50 Super, as shown in the image opposite, came onto the market in 1965.


RE: tables in forums editor? - madscijr - 06-01-2024

(06-01-2024, 11:43 AM)Kernelpanic Wrote:
Quote:Don't give up, just use the tags at the site Steve posted:
OK, I tried something - it worked, but the behavior was a bit strange.
Is there a way to test it offline in a browser? I couldn't find anything in the descriptions, and with it doesn't work in the browser.

Let's start simple, here's the most basic table: 

Heading Column AHeading Column BHeading Column C
Row 1 Col ARow 1 Col BRow 1 Col C
Row 2 Col ARow 2 Col BRow 2 Col C
Row 3 Col ARow 3 Col BRow 3 Col C

Here is the source code that makes the table:

Code: (Select All)
[table=95]
[tr] [th]Heading Column A[/th][th]Heading Column B[/th][th]Heading Column C[/th][/tr]
[tr] [td]Row 1 Col A[/td][td]Row 1 Col B[/td][td]Row 1 Col C[/td][/tr]
[tr] [td]Row 2 Col A[/td][td]Row 2 Col B[/td][td]Row 2 Col C[/td][/tr]
[tr] [td]Row 3 Col A[/td][td]Row 3 Col B[/td][td]Row 3 Col C[/td][/tr] [/table]

Try copying it into Notepad or Teachtext or Nano or whatever it is you like to edit plain text with, and just change the text between the tags and try pasting that in a forum post. 

Don't worry about styling or table width or anything else yet, just get comfortable with the basics!

PS I did notice one thing, either the [ table ] tag needs the "={percentage width}" or the [ tr ] tags need a space after them, because I just posted this table code: 

Code: (Select All)
[table]
[tr][th]Heading Column A[/th][th]Heading Column B[/th][th]Heading Column C[/th][/tr]
[tr][td]Row 1 Col A[/td][td]Row 1 Col B[/td][td]Row 1 Col C[/td][/tr]
[tr][td]Row 2 Col A[/td][td]Row 2 Col B[/td][td]Row 2 Col C[/td][/tr]
[tr][td]Row 3 Col A[/td][td]Row 3 Col B[/td][td]Row 3 Col C[/td][/tr][/table]

and it messed EVERYTHING up! I couldn't even find the button to edit my post and fix it (finally I did at the top of the page). 

I tried fixing the table code using trial & error, and hit upon adding the "=95" and putting a space after the [ tr ] tags, and it seems to be working now. 

Does anyone have any idea why?


RE: tables in forums editor? - Kernelpanic - 06-01-2024

Here is a list of the commands: MyCode Dokumentation

Well, I know all this, I have been creating websites for years. My editor has been always Homesite. What annoys me is that I can't do it offline. Develop the page/depiction, check it in the browser, and if it's good, upload it.
As it is now, I can only develop it, and then have to see if it works online. Cumbersome!

Update: This is what it looks like in HTML:

[Image: Zuendapp-Web2024-06-01.jpg]


RE: tables in forums editor? - SMcNeill - 06-01-2024

(06-01-2024, 03:50 PM)madscijr Wrote: PS I did notice one thing, either the [ table ] tag needs the "={percentage width}" or the [ tr ] tags need a space after them, because I just posted this table code: 

Code: (Select All)
[table]
[tr][th]Heading Column A[/th][th]Heading Column B[/th][th]Heading Column C[/th][/tr]
[tr][td]Row 1 Col A[/td][td]Row 1 Col B[/td][td]Row 1 Col C[/td][/tr]
[tr][td]Row 2 Col A[/td][td]Row 2 Col B[/td][td]Row 2 Col C[/td][/tr]
[tr][td]Row 3 Col A[/td][td]Row 3 Col B[/td][td]Row 3 Col C[/td][/tr][/table]

and it messed EVERYTHING up! I couldn't even find the button to edit my post and fix it (finally I did at the top of the page). 

I tried fixing the table code using trial & error, and hit upon adding the "=95" and putting a space after the [ tr ] tags, and it seems to be working now. 

Does anyone have any idea why?

It's because of the underlying process of what's going on here. 

Forums are, at their heart, just means of posting and sharing text information with others.  How's the forum supposed to know that <br> is html, or just text like I'm using here?  And does one REALLY want to allow raw HTML to be posted in a set of forums?  What happens if I type <width=10%> and then leave it and forget the </width> end tag?  Does that mean that ALL text posted after mine -- even that of other folk's responses below mine, are now only 10% of the screen width???

How about html commands which perform other actions?  How should a set of forums behave with <script>?  Should it be able to grab and share someone's geolocation, for example?

Code: (Select All)
<script>
const x = document.getElementById("demo");

function getLocation() {
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(showPosition);
  } else {
    x.innerHTML = "Geolocation is not supported by this browser.";
  }
}

function showPosition(position) {
  x.innerHTML = "Latitude: " + position.coords.latitude +
  "<br>Longitude: " + position.coords.longitude;
}
</script>


What about even more ambitious uses of HTML??

I, for one, wouldn't want to allow raw uses of HTML inside a set of forums!!  The possibility for someone screwing up something and ruining everything for everyone, is almost beyond belief, in my opiinon.

And, apparently in the opinion of the forum creators as well.  Tongue

To mitigate any sort of chance for raw HTML doing stuff that it shouldn't be doing, the developers of the mybb forum software decided to add in an abstraction layer between what the user types and what the forum processes as html, and they created MYCODE. 

And the easiest way to think of MYCODE is to think of it just like QB64PE!

QB64PE takes a BAS file, does its magic, and turns it into C, which is then compiled.
MYCODE takes raw TEXT, does its magic, and turns it into acceptable HTML, which your browser then uses for formatting/display.

This means that the only pseudo-html which you can add into your code, HAS to be in MYCODE format.  Otherwise, it's like I've shown in this post here -- you can put <whatever you want in brackets>  and yet <<NOTHING IS GOING TO HAPPEN>>!

<b> doesn't do bold.  That's just raw text of a "less than symbol", a "b", and a "greater than symbol".  No HTML at work here -- just raw text!

So how would one get bold text to appear??

Instead of using HTML, you use the MYCODE format and syntax, which it'd then translate for you -- which is why the translation syntax is so similar!  As a developer yourself, if you already know HTML, and know <b> is bold and </b> is bold-off, how are you going to make a pseudo-html which you can use to distinguish between that HTML command and the version you want for your MYCODE??

"Well heck, I'd just change "<" and ">" to "[" and "]"!

Can't get much simpler or easier than that!  Wink

But then, you come along with STYLES and all the options that some commands have...  like <TABLE> for example.  How many variations of syntax can you support with TABLE??

Let me see what I can list, off the top of my head:
boarder, border-collapse, border-radius, border-style, border-color...  and that's just for the BORDER of a table!  You can also do background-color, and color, and title caption, and headers and footers and lions, and tigers and bears!!

Now, how do you present ALL those possible options for an end-user to have, in your translation layer??  They're all optional, as none are really required to make a table, but they're all POSSIBILITIES of how you can format a table with HTML.

...As someone who helps develop QB64, which translates BAS to C, I can tell you how I'd do things: I'd just pick and choose how much work I wanted to put into it, and decide which properities I wanted to expose to the end-user!

Honestly, that's what we do!!

For a quick example, take a look at the _SaveImage command, in our own language.  PNG files are compressed with zlib-style compression.  In their makeup, there's options for HOW MUCH compression one wants for that file, on a scale from 0 to 9.  0 is no-compression (just store the data).  9 is max compression (work to make it as small as possible).  If you write a PNG file from scratch, and compress it yourself, you can toggle that compression level to whatever suits your needs the most.

Can't do that with _SaveImage.  All you get with it is what we expose and give you -- give us a file name, we'll write the rest with the standard options which we want to use. 

Want more than that??

Feel free to change the source and fix it to whatever the heck you need on your own, dang it!!  Big Grin



And that's basically EXACTLY the same thing that the MyBB developers do.  They offer up what they consider to be the most common options, expose the things they want to expose, and then if the end-user wants more, they have to write the CUSTOM MYCODE to handle it themselves.

And so, ole Steve sat down and wrote the CUSTOM MYCODE for tables.  And what I wrote was basically:

1) Take raw text in this format "[ table=### ]" and translate it to become "<table style="width:###%">.

So, when you type in JUST [ table ], it basically gets ignored.  That's NOT the syntax/format which Steve wrote for the forums here.  It'll just be processed as raw text, as you can see when I put it all together here with not spaces in the formatting: [table]

See that [table]?  The fact you can see [table] means it didn't get translated to become <table>...  It's just raw text which didn't meet the translation pattern we set out to convert MYCODE to HTML.

So why the heck does that explode your screen and REALLY screw things up???

Take a second and look at how our posts are formatted on the screen.  Notice how we're dealing with HEADER/POST/FOOTER style format?

Now, you tell me, what do you think is going to happen when you add a series of <tr><td> and such to one of those elements???

You DIDN'T create a table when you failed to specify the proper format for [ table=### ]...  Yet, you did specify the proper format for rows and dividers -- [ tr ] and [ td ]...

So WHAT exactly are you turning into rows and dividing??

Think about that, ponder on it yourself, and then perhaps you'll understand why everything tends to blow up on you.  Look at the existing format...  Figout out where that [ tr ] and [ td ] would be tossing itself into the process of stuff, and then tell me if you don't think it should glitch out like it does on you.  Wink

The only way [table], by itself, will work, is if some admin goes back in and writes a CUSTOM MYCODE to recognize that simple format and turn it into <table>... 

(And if some non-lazy admin ever feels the itch to do that, go ahead and add in an option for background-color and default text color.  And border width.  And border color.  And maybe style and radius... and... Big Grin )


RE: tables in forums editor? - madscijr - 06-03-2024

(06-01-2024, 05:41 PM)SMcNeill Wrote:
(06-01-2024, 03:50 PM)madscijr Wrote: PS I did notice one thing, either the [ table ] tag needs the "={percentage width}" or the [ tr ] tags need a space after them, because I just posted this table code: 

Code: (Select All)
[table]
[tr][th]Heading Column A[/th][th]Heading Column B[/th][th]Heading Column C[/th][/tr]
[tr][td]Row 1 Col A[/td][td]Row 1 Col B[/td][td]Row 1 Col C[/td][/tr]
[tr][td]Row 2 Col A[/td][td]Row 2 Col B[/td][td]Row 2 Col C[/td][/tr]
[tr][td]Row 3 Col A[/td][td]Row 3 Col B[/td][td]Row 3 Col C[/td][/tr][/table]
and it messed EVERYTHING up! I couldn't even find the button to edit my post and fix it (finally I did at the top of the page). 

I tried fixing the table code using trial & error, and hit upon adding the "=95" and putting a space after the [ tr ] tags, and it seems to be working now. 

Does anyone have any idea why?
It's because of the underlying process of what's going on here. 

... {very long diatrabe} ...

Whoa, whoa, whoa, Nelly! 

I was just trying to help our friend Kernelpanic, and noticed that leaving the ={width} out of the table tag did some very weird things. 

No need to get defensive about MYCODE or explain why we don't want to let users post raw HTML, I get all that. 

I just didn't know that the ={width} was a required parameter for the table tag. 

Chill, buddy! No one's saying anything wrong with how we do tables here... I was just very confused for a minute! 

Actually, thank you for making all this possible! 

PS I'd still like to help Kernelpanic learn to add a simple table to his posts, but that's neither here nor there.