Info Insert Code

dalpat077

Bluelighter
Joined
Oct 14, 2019
Messages
3,092
Feel like an idiot for asking because I should know the answer.

But what is the "Insert Code" (into a post) for and how is it used? Does that code, if inserted correctly, get executed or are additional permissions required/rights to be granted in order for that to happen?

Somebody around these parts has a link in their signature to some type of help file and I remember reading through it and seeing this addressed but I cannot remember who the member is.

Never mind. It was @CFC. And it appears that it's merely for display purposes i.e. the code is never executed right?

"Displays text in one of several programming languages, highlighting the syntax where possible."

 
Last edited:
That's right, BB Code is mostly just a way of doing graphical or presentational things in your posts. When you enter the correct syntax, it will perform an action that's been pre-programmed into the forum software, like putting colored boxes around text or creating little anchor points in long posts to make them easier to navigate etc. It's mostly just useful for staff like for making up guides and tutorials, but it also allows members to be more expressive in their posts if they feel the need.
 
That's right, BB Code is mostly just a way of doing graphical or presentational things in your posts. When you enter the correct syntax, it will perform an action that's been pre-programmed into the forum software, like putting colored boxes around text or creating little anchor points in long posts to make them easier to navigate etc. It's mostly just useful for staff like for making up guides and tutorials, but it also allows members to be more expressive in their posts if they feel the need.
Nah. I don't think I expressed myself too well in just looking now.

I was specifically referring to the BBCODE "Programming code display" which "displays text in one of several programming languages, highlighting the syntax where possible.". I guess the clue is in the word "display". Never saw that yesterday i.e. easy for somebody like me to assume that if you use the insert code function nd input some valid code in that block then it would get executed when the post was viewed.

Here's a Javascrtipt example but as you can see it's only going to display the actual code and its not executing it:

JavaScript:
<a href="https://time.is/Johannesburg" id="time_is_link" rel="nofollow" style="font-size:36px">Time in Johannesburg:</a>
<span id="Johannesburg_z018" style="font-size:36px"></span>
<script src="//widget.time.is/t.js"></script>
<script>
time_is_widget.init({Johannesburg_z018:{}});
</script>
 
This was kinda the rough plan:

yN0Lm73.gif


But that's just an animated GIF and accepts no inputs and doesn't advance. Very handy if you want time to stand still and procrastinate but that's defeating the object for my intended purpose! :ROFLMAO:
 
Last edited:
  • Like
Reactions: CFC
Ah I see. No, for reasons you might imagine folks aren't allowed to execute their own code in posts lol. It would of course be possible to program something like a clock into XenForo (using your own computer's time) and then insert it into posts via BBCode but, aside from your fair self, I'm not sure how much call there would be for such a thing as it does seem rather niche and not something I have any say in anymore I'm afraid ;)
 
I was specifically referring to the BBCODE "Programming code display" which "displays text in one of several programming languages, highlighting the syntax where possible.". I guess the clue is in the word "display". Never saw that yesterday i.e. easy for somebody like me to assume that if you use the insert code function nd input some valid code in that block then it would get executed when the post was viewed.

As you and CFC have deduced, the CODE command is a display only function. Sites like ours running Xenforo or other discussion forum software are focused on communication, not programming or execution. Key to that point - how many programs ever executed correctly the first time? I'll attest that damn few of mine have :D Sometimes you can crash, other times you might fall into an endless loop...and if it's running on a server somewhere you just posted it to...how will it ever end? Will it run amok sucking resources and locking folks up until it suffocates and dies? Will it start writing garbage to the server or cache until those choke up and die? Will it start writing to places that disrupt the site's code for generating a page....and really bork up the accessibility for everyone, and an admin is blind to what caused it or how-where to fix it?

There is way too much that can go wrong, so sites like ours avoids programming and execution. Members can share code (display it) for discussion, but there is no programming you can execute on our site in the manner you propose, for your safety and ours.


/note to self, keep loaded weapons away from dalpat
 
/note to self, keep loaded weapons away from dalpat
In fairness and in my defense: my intentions were honorable and in the true spirit of HR and friendship!

I wanted to post a countdown timer based on real time in their particular timezone on a particular thread that would have put the OP on a guilt trip every time it appeared (for not having made the time and effort to get off of their ass and go down to their local rehab. center). :ROFLMAO:
 
Top