06-01-2024, 05:41 PM
(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.
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!
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!!
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.
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... )