Do I need an HTML file for every single page on my website? - html

Say I have a product website, like Amazon (this is not the case, but it will help me explain my point), and I have a URL for every single product (such as with Amazon)...
Do I need to copy-paste and modify an HTML file for every single individual product page, or is there a way to use a "model" on which I can base all my other pages without recopying the whole code and modifying a few things in each?
I've just started learning HTML and web development, so bare with me if I'm asking a stupid question.
It just seems odd to me that a million-page website should host a million+ individual, nearly identical, HTML files.
Thank you very much in advance.
P.S. I'm using Amazon's brand name as an example here, and am not affiliated with anything related to it. Thank you for understanding.

No, you do not need an HTML file for every single page on your website. While you could do that, it is becomes very infeasible to manage the bigger your site becomes. On most websites you would have the following components:
A front end - consists of HTML code and usually some sort of template engine with placeholders for your data
A backend - consists of your data store (usually a database).
There will also usually be some form of API and/or middleware between your front end and backend.
If you go to https://example.com/myproductid in your browser, your computer will send that request to the web server. The web server will then retrieve your data, load it into the correct template, and serve the page to you.
In traditional HTML and PHP only websites, you would have to reload the entire page each time you went to a new product. However, you can instead use a technique called Ajax to only update certain parts of a web page rather than reloading the entire page. That way you can just update the text, images, and links that are specific to the product, and the rest of the page would stay the same. (Note: Ajax originally used XML, modern implementations usually use JSON).
Ultimately, you will want to learn some JavaScript and then start looking into various web frameworks or libraries such as ReactJS.

Not you Can have only one page for all product, but you have to make it Dynamic.

Yes you need an HTML document for your each webpage, like for Home page, contact us page you need different HTML documents

Related

Display JPG based upon URL

I have a JPG in the header section of a responsive HTML page. I want to use the same site content for multiple domains that will point to my single set of files at my hosted URL. Example : mysite.com will host all files. But a second site - example theirsite.com will point in a forward to my hosted files location.
All the content will be the same, EXCEPT FOR the one image file (logo.png) or can be any name, but I would like to see if I can image-substitute 1 file (logo.png) to render so that, when visitors come to mysite.com, they see my file. When visitors come to theirsite.com they will see the logo file for theirsite.com instead of for mysite.com Sorry if I have not explained this professionally.
There are two real ways to do this. The best way is to handle it server-side.
You would need some sort of dynamic site generation, such as PHP. As the site isn't changing on each request, I'd recommend doing this generation ahead of time. Then you can utilize static hosting on CDNs and such. The specifics of how you do this depend on your technology choice. And, it matters little what you pick.
Doing the switch server-side is better, as crawlers will be able to see the right version of the site. Most crawlers don't run client-side code.
The second option is to handle it client-side. In this case, I'd recommend including a site definition file for each domain and writing some JavaScript to check the hostname the site was loaded on, and load the right site definition file. That file could contain elements and attributes to replace. Again, this is less desirable of an option, but still possible.

It's fast to build and update a static site or a dynamic site?

Good day, everyone!
I'm currently building 2 sites: one of them is my 'personal website' that will contain contact information, current and finished projects. (Like a presentation card, you know what I'm talking about!).
The other one it's a site regarding a tool that I'm currently developing: I want to make 3-4 section with classic things about a software: what it is, what it does, news about developments, a FAQ section and a download page.
Now, the problem is: I don't want to waste time with such 'silly' website. I want make it fast and update it easily.
I've got 2 ways in my mind:
1) Create a dynamic site (php) that will 'build' pages from a database that contains all things like finished projects, news feed and so on. I have to create the backend for content insertion, but once i've done it I can insert new content in few seconds.
2) Build a site based on static pages (classic html) filled MANUALLY with new content (like the weekly news feed); isn't much 'professional', it's much more fast to grow up but can be difficult to insert new content (Every time I want to make a news I have to write the title in an html tag, bold content with tag and so on) and move manually the old news to another page. Maybe exist external tool to help me doing that?
I always thought that static webpage aren't used even for site that 'allows' new content being updated often (once a week) but I found that isn't completely true: LOT of site that I like (medium popularity software sites) it's just a bunch of text on a static page.
I guess that isn't a smart thing waste time build a nice site for a poor developed software, isn't it?
Also, isn't kind of newbie build a site with such an old way?
What tool can I use for fast 'formatting' html news text?
Any suggestion for creating these website with fewest time spent?
When I develop websites, I use a basic template: a "toolbar" or "navbar" at the top of the page and an iframe tag that contains the content and pages browsed. You can learn how Joomla! and Wordpress platforms work and see the idea behind it: a group of files build an html file from data stored inside XML files (either in physical disk or in a database). Those files and classes build and render those pages until you get what you see in a static (sometimes dynamic with JavaScript/jQuery) page/file. Open-Source is a great thing - the human kind must use it wisely.
I will also recommend using JSON or some other database to get the needed code and append it to the body. I use XMLHttpRequest() to get code inside json, i then parse it get the html string and append it to the body of my website. It works well for me.‎ ‎ ‎ ‎ ‎

Seperate html pages for each screen in Jquery mobile

I am newbie to Jquery Mobile, so far what ever examples i searched contains only one html page for whole application, with multipe div tags where each page/screen is defined as div tag with data-role as page with some header and footers optionally. Based on user actions, we are hiding some div's(pages) and showing only expected page. Also, this multi-page template seems to be standard design, as written by some blogs. Are there any other designing ways? what I would like to have is multipe html pages, for ex one for login, one for home, one for contact etc. Other wise it is difficult to understand/code/debug issues, especially people from Java background like me.So, what I want is some kind of MVC design with JQueryMobile, like each view/screen as sepearate html associated with one js (Controller). Can we have multiple html pages in JqueryMobile app? If possible how to pass data/ maintain session between them? Any samples are most welcome. Thanks In Advance.
Note: Also I don't want server side includes, may app contains 10 to 15 screens, each page will make a webservice call and fetch some data and map it to UI.
As jerone mentioned above, the jQuery Mobile documentation clearly says
We strongly recommend building your site or app as a series of separate pages like this because it's cleaner, more lightweight and works better without JavaScript.
See http://jquerymobile.com/demos/1.2.0/docs/pages/page-template.html
Each page (which can be a static HTML file or anything produced by a script (e.g PHP, Python or whatever)) is thus standalone and transitions from one page to another are done using AJAX calls.
There is no such thing as a controller except if you assume that your browser is one!
You can use multiple html files if you want. jQuery Mobile will automatic include these with AJAX: http://jquerymobile.com/demos/1.2.0/docs/pages/page-navmodel.html
Anyways, jQuery Mobile recommends one big html file with multiple pages.
From http://jquerymobile.com/demos/1.2.0/docs/pages/page-template.html
This template is standard HTML document with a single "page" container inside, unlike a multi-page template that has multiple pages within it. We strongly recommend building your site or app as a series of separate pages like this because it's cleaner, more lightweight and works better without JavaScript.

combining two pages in HTML

I'm creating a web site for an institute, since I'm new to this field I want to know whether I can create a page for header part(which containing the logo and the name of the institute) and can I combine that page to each and every page I'm creating. If it is possible suggest me how can I combine the header part & newly created page..
Surprisingly, there is no way to do that in straight HTML. Not even in HTML5.
If you are only creating a few pages, I suggest simply copy-pasting the content to each page's HTML file. Admittedly, that approach can quickly become a burden.
Some web servers will parse the HTML of a page before it is served out, look for a specific kind of HTML comment, and then interpret that as a command to insert the contents of another file. This feature is called "server-side includes" or "SSI". Some web servers, such as Apache Tomcat, have this feature but turn it off by default due to security concerns.
If you are building dynamic pages where the HTML content being served is created on-the-fly with a programming language rather than read from pre-created disk files, then you can definitely include fragments of HTML using that programming language.
I suggest you do some additional study to build up your web authoring skills. One great source of training is the book "Head First HTML with CSS & XHTML" from O'Reilly Media, Inc.
You can do pull html code from different places and merge them with php. It's been years since I've done it, so I can't get into the particulars.

How to show large amount of data in page wise using html?

How to show large amount of data in page wise using HTML and how to restrict the page data.
ex:suppose if we save the page using browser the data should not be saved by the users.
1) To show parts of HTML data divided over a few pages, you'll probably want to have the data in a database and then retrieve, format it and the deliver to your user.
2) You can't restrict the users from saving the data on your page when using HTML. The rationale is that what the user sees must definitely be downloaded from your site. That being said, when he saves the page, he'll definitely be able to save all the text and HTML. If your data is really that important and needs to be protected, consider using other technologies, such as Adobe Flash or even Java Applets.
Hope it helps. Cheers!
You can use hyperlinks to divide the page data in multiple pages or needs to use some server side scripting like PHP/ASP.
You cannot restrict user to save the html output however you can use java applets or flash to do that.
Not sure I understood the question, but if you want to show something on the page that user cannot easily download or copy you can use Flash. There is no way to do it with HTML.