+ 2

Can u create a multipage website on sololearn or u can only create single page websites

18th Oct 2024, 10:18 AM
Kwaw Essien
Kwaw Essien - avatar
9 Réponses
+ 2
You can make multi-page website on sololearn
18th Oct 2024, 10:30 AM
Alhaaz
Alhaaz - avatar
+ 2
Thanks Kwaw Essien I was actually going to add more pages ( refer to my <!-- comments --> inside the code )
19th Oct 2024, 3:39 AM
BroFar
BroFar - avatar
+ 1
Could u give me an example with a code
18th Oct 2024, 10:47 AM
Kwaw Essien
Kwaw Essien - avatar
+ 1
Wow thats a lot of code Thanks 😄
19th Oct 2024, 3:17 AM
Kwaw Essien
Kwaw Essien - avatar
0
The SoloLearn code editor only supports a single HTML file and a single CSS file and a single JS file. But that doesn't mean you cannot create multiple web pages. How it works is: You have components in your HTML. head, body, div tags, p tags, etc. The contents of those can be changed programmatically. So while you only have those three source files, you can dynamically generate what is shown on the screen. That makes multiple pages possible. This is typically called a single-page application. When you create an HTML page, create DIV tags to hold the dynamic content. That could be the menu, the title, the body, or elements within the body. Then use JavaScript, attached to buttons, to swap out that content. You see this on many web pages these days. Frameworks like REACT use this technique to build full scale applications that may only have five "real" pages but generate endless viewable pages which are dynamically generated. The HTML can be very basic. All the work is done in JavaScript. In a real-world environment, you can have multiple HTML files and each can have it's own dynamic content. In SoloLearn, you are stuck with a single HTML file. But you can accomplish a lot with that. Here is a sample: https://www.sololearn.com/en/compiler-playground/Ww74ViL7mMTl This shows that new content is created whenever a button is clicked. It's very basic so hopefully you can understand how it works.
18th Oct 2024, 6:50 PM
Jerry Hobby
Jerry Hobby - avatar
0
Thanks again😄
19th Oct 2024, 12:10 AM
Kwaw Essien
Kwaw Essien - avatar
0
Ok👍
19th Oct 2024, 12:25 PM
Kwaw Essien
Kwaw Essien - avatar
0
Oo
20th Oct 2024, 7:52 AM
MS kha016
MS kha016 - avatar