+ 1

Do I have to make 500 html files to show my 500 product details pages? Or I can just do it inside one html file?

I have these confusions actually.... I never got a tutorial or any suggestions on this topic

10th Oct 2020, 6:41 AM
Khalid Hassan
Khalid Hassan - avatar
11 Respostas
+ 4
you would have an array of all products and you would loop through the array and render them all on the screen. You can do it in javascript like: let products = [ { _id: 1, name: "Shirt", price: 100 }, { _id: 2, name: "Pent", price: 150 }, ] products.forEach(product => { document.getElementById("products-div").innerHTML += ` <div> <h1>${product.name}</h1> <h2>${product.price}</h2> </div> ` })
10th Oct 2020, 6:57 AM
maf
maf - avatar
+ 2
Use a database to store your product details and dynamically load them into your page using any back end language of your choice.
10th Oct 2020, 8:25 PM
Kirabo Ibrahim
Kirabo Ibrahim - avatar
+ 1
Thanks man it was helpful
10th Oct 2020, 6:58 AM
Khalid Hassan
Khalid Hassan - avatar
+ 1
Noob Dev no problem :)
10th Oct 2020, 6:59 AM
maf
maf - avatar
0
Noob Dev use reactjs with react-router and use dynamic routing.
10th Oct 2020, 6:49 AM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
0
How does that work actually?
10th Oct 2020, 6:50 AM
Khalid Hassan
Khalid Hassan - avatar
0
Just need a little bit of explanation
10th Oct 2020, 6:51 AM
Khalid Hassan
Khalid Hassan - avatar
0
Learn reactjs first
10th Oct 2020, 6:51 AM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
0
Thanks man
10th Oct 2020, 6:52 AM
Khalid Hassan
Khalid Hassan - avatar
0
One css file is good enough for 5000 html pages 🙏
11th Oct 2020, 3:24 PM
Sanjay Kamath
Sanjay Kamath - avatar
0
Hello.guys
11th Oct 2020, 6:41 PM
Yash Rain
Yash Rain - avatar