React & mysql, compare for HTML |
React & mysql, compare for HTML |
jimbondy |
Nov 25 2022, 10:02 PM
Post
#1
|
Novice Group: Members Posts: 29 Joined: 21-November 22 From: Essex Ontario Member No.: 28,646 |
Hi,
I'm new to this board and, as well, a novice to HTML and would very much appreciate your help. My home game is Visual Basics (VBA) but I've always wanted to learn HTML, CSS & Javascript. I've learned some of the fundamentals of HTML & CSS; totally enjoy it and intend on continuing. I understand that in the near future I may need a tool called 'React' to organize a library of my sub-routines. My question: Is this the same as MYSQL as this program will be part of my studies? If the case is that I do need React, I've found that it costs $$ and I'm on a minimal budget. Is there something that I can download for free? Your thoughts, please. Any information on these will be greatly appreciated. Thanks so much JimmyB |
pandy |
Nov 25 2022, 10:09 PM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
Do you mean this React https://reactjs.org/ ? I don't see how that would help you learn HTML and CSS? And no, it isn't a the same as mySQL, which is a database.
|
jimbondy |
Nov 25 2022, 10:50 PM
Post
#3
|
Novice Group: Members Posts: 29 Joined: 21-November 22 From: Essex Ontario Member No.: 28,646 |
Do you mean this React https://reactjs.org/ ? I don't see how that would help you learn HTML and CSS? And no, it isn't a the same as mySQL, which is a database. Well no, it is not to help me learn. I get the impression that it will help me in the near future to organize my subroutines (repetitive mini-program module retrievals). Not sure of the exact word used in HTML |
pandy |
Nov 26 2022, 02:03 PM
Post
#4
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
As I understand it it's a JavaScript library, i.e.basically a collection of canned scripts, geared towards user interface design. HTML isn't programming so there's neither routines or subroutines. Do you mean you want to save snippets of HTML for later use?
|
jimbondy |
Nov 30 2022, 12:45 AM
Post
#5
|
Novice Group: Members Posts: 29 Joined: 21-November 22 From: Essex Ontario Member No.: 28,646 |
Yes, so to speak.
IE, in VBA I've found instances where I need to use the same block of code numerous times throughout a program. For example, I have a Combobox that I've inserted into a module as a subroutine. It has 46 lines of code and is loaded with "IF/Then/Else" statements. Since I have 30 sheets in this program I'd have to type out 46 lines of code for each since it supplies a pull-down menu on each page. So instead of slowing down my program with perhaps hundreds of lines of code, I can just 'Call' the exterior (subroutine) which I only typed once. So... I'm just learning HTML & CSS for now and found that my CSS can be on a separate 'Stylesheet' and accessed through my Visual Studio. So then the answer is Yes since I am linking back and forth there. It just keeps the original code looking cleaner. So what I'm understanding is that 1) Reactjs is a library for Javascript code only, where I just store code snipits but cannot link to them. 2) MYSQL can not be used in place of Reactjs What I don't get is why MYSQL (being a database) could not be used to store code somewhat like Reactjs does...since you mentioned React is just a place to store code. Sorry, I'm not trying to be impossible. Just trying to save, (in short demand), money. Being a senior on a tight budget, I usually don't spend money foolishly...unless necessary...LOL. Once I get further into the courses I'm sure I'll see the light that you're trying to shine. Thanks so much for your help JimmyB |
pandy |
Nov 30 2022, 06:46 AM
Post
#6
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
I don't think you can store your own code in React. As I understand it it's a JS library, i.e. a collection of ready made scrips you can pull from.
You asked about HTML and CSS and then there are no subroutines. Of course you can save snips to reuse them, but you don't need anything more complicated than text files for that. |
Christian J |
Nov 30 2022, 07:34 AM
Post
#7
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
So instead of slowing down my program with perhaps hundreds of lines of code, I can just 'Call' the exterior (subroutine) which I only typed once. So... I'm just learning HTML & CSS for now and found that my CSS can be on a separate 'Stylesheet' and accessed through my Visual Studio. So then the answer is Yes since I am linking back and forth there. It just keeps the original code looking cleaner. Blocks of HTML code can be inserted with PHP's include expression: https://www.php.net/manual/en/function.include.php QUOTE So what I'm understanding is that 1) Reactjs is a library for Javascript code only, where I just store code snipits but cannot link to them. Not sure I understood the above. Reactjs is just a prewritten javascript library, and according to https://en.wikipedia.org/wiki/React_(JavaScript_library) it's also free. Normally you wouldn't modify anything in such prewritten libraries. You can certainly write your own javascript(s) and embed on your web pages from external .js files. This is useful for javascript code you want to use on multiple wep pages. You can also let such external javascripts create or change HTML code, but that makes the web pages javascript-dependent, which reduces usability for users or search engine bots that don't support javascript. PHP is generally a more robust way to include common pieces or HTML code. QUOTE 2) MYSQL can not be used in place of Reactjs What I don't get is why MYSQL (being a database) could not be used to store code somewhat like Reactjs does...since you mentioned React is just a place to store code. You can indeed store data in (e.g. MySQL) database tables. Reading or writing to the database is done with database queries, these may in turn be done from e.g. PHP. Here are a couple of examples (the blue code is PHP, the red MySQLi or PDO database queries): https://www.php.net/manual/en/mysqlinfo.api.choosing.php I think a database only makes practical sense if you need to generate hundreds or thousands of web pages (such as an online forum or -store). For anything smaller PHP includes should do. |
jimbondy |
Nov 30 2022, 09:32 AM
Post
#8
|
Novice Group: Members Posts: 29 Joined: 21-November 22 From: Essex Ontario Member No.: 28,646 |
Thanks a lot, Christian. You've made it about as clear as I can expect for my level of expertise, (or lack of...LOL). I do get what you're saying and will surely understand it better as I go along.
Thanks again to both you and Pandy for your help. |
pandy |
Nov 30 2022, 05:33 PM
Post
#9
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
I don't think it's usual to store HTML in a database at all. As in the example with a forum, the data, what we type here, is stored in a database. But the HTML comes from templates. Maybe there are exceptions.
|
Christian J |
Nov 30 2022, 06:32 PM
Post
#10
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
I don't think it's usual to store HTML in a database at all. As in the example with a forum, the data, what we type here, is stored in a database. But the HTML comes from templates. Parts (or all) of the HTML is generated by PHP, after fetching the data from the database. For example, this forum's PHP script may generate more HTML for each forum post/reply that it finds in the database query. QUOTE Maybe there are exceptions. I remember one guy that did just that, basically using a whole database the way we normally use includes. I can't think of any good reason to do it like that, it certainly caused a bit of confusion. |
jimbondy |
Nov 30 2022, 08:28 PM
Post
#11
|
Novice Group: Members Posts: 29 Joined: 21-November 22 From: Essex Ontario Member No.: 28,646 |
Thanks All
JimmyB |
pandy |
Nov 30 2022, 08:50 PM
Post
#12
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
Well, the templates will be PHP mixed with HTML (for this forum). But I doubt very much any sensible program stores large snips of HTML in a database. I don't think the large number of requests to the database that would be needed would be effective either. Who was that guy that did that? Someone here?
|
Christian J |
Dec 1 2022, 09:03 AM
Post
#13
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
But I doubt very much any sensible program stores large snips of HTML in a database. I don't think the large number of requests to the database that would be needed would be effective either. You're the only one that brought it up. QUOTE Who was that guy that did that? Someone here? No public person. I guess he simply used the tool that he was most familiar with... |
Christian J |
Dec 2 2022, 09:50 AM
Post
#14
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
Thanks a lot, Christian. You've made it about as clear as I can expect for my level of expertise, (or lack of...LOL). I do get what you're saying and will surely understand it better as I go along. Thanks again to both you and Pandy for your help. You're welcome! I should add that javascript is normally run on the client side (i.e., in the user's browser), while PHP is run on the server side (i.e., on the server, before the output of the PHP script is sent to the user's browser). The output of PHP can be e.g. HTML, CSS or javascript. When opening HTML files directly from on your own PC's local file system, today's browser's sometimes warn you about running javascript, but that warning can be disabled. But to open a PHP page in a browser on your own PC you need a local testing server, since browsers don't run PHP code. A package like https://en.wikipedia.org/wiki/XAMPP makes this fairly simple (though you could install a "real" server program like Apache instead if you prefer that). |
jimbondy |
Dec 3 2022, 02:32 PM
Post
#15
|
Novice Group: Members Posts: 29 Joined: 21-November 22 From: Essex Ontario Member No.: 28,646 |
Great information.
Thanks again JimmyB |
Lo-Fi Version | Time is now: 25th April 2024 - 07:15 AM |